diff --git a/FinalProject/ListDisplay.cpp b/FinalProject/ListDisplay.cpp index 2ca2c75..f31d483 100644 --- a/FinalProject/ListDisplay.cpp +++ b/FinalProject/ListDisplay.cpp @@ -24,7 +24,7 @@ const std::string ListDisplay::searchForRecordTypeToString() const { ListDisplay::ListDisplay(const List &_allRecordsPtrList) : allRecordsPtrList(_allRecordsPtrList), fromDate(), toDate(), searchForStu(), searchForCourseName(""), - searchForRecordType(StuRecord::Any), recordNumPerPage(20), + searchForRecordType(StuRecord::Any), recordNumPerPage(10), currentPageIndex(0), maxPageIndex((allRecordsPtrList.length() - 1) / recordNumPerPage), sortOrder(ASCENT), sortByProp(RecordID) { @@ -420,8 +420,9 @@ void ListDisplay::promptForSearchStuID() { // std::cin.ignore(); tempStuID = safeInputNum("Please input a positive integer.\n", [](const int &num) { return num >= 0; }); - this->searchForStu.setNumber(tempStuID == 0 ? this->searchForStu.getNumber() - : tempStuID); + if (tempStuID != 0) { + this->searchForStu.setNumber(tempStuID); + } this->reapplyFilter(); } @@ -442,8 +443,9 @@ void ListDisplay::promptForSearchStuName() { // std::cin >> tempStuName; // std::cin.ignore(); std::getline(std::cin, tempStuName); - this->searchForStu.setName(tempStuName == "0" ? this->searchForStu.getName() - : tempStuName); + if (tempStuName != "0") { + this->searchForStu.setName(tempStuName); + } this->reapplyFilter(); } diff --git a/FinalProject/StudentInfoManager.cpp b/FinalProject/StudentInfoManager.cpp index 0279596..86c6b50 100644 --- a/FinalProject/StudentInfoManager.cpp +++ b/FinalProject/StudentInfoManager.cpp @@ -934,8 +934,9 @@ void StudentInfoManager::mainloop() { } else if (cmd == infoManagerCommand::home::closeFile) { this->closeFile(); - this->promptForFileName(); - this->readFile(); + if (this->promptForFileName()) { + this->readFile(); + } this->displayer.reapplyFilter(); } else if (cmd == infoManagerCommand::home::quit) {