diff --git a/main.cpp b/main.cpp index 032b32b..ad0c70b 100644 --- a/main.cpp +++ b/main.cpp @@ -958,7 +958,6 @@ void processcustomizationfile(const std::string &now_string, std::string token,token2; - std::string iclicker_remotes_filename; std::vector > > iclicker_questions(MAX_LECTURES+1); for (nlohmann::json::iterator itr = j.begin(); itr != j.end(); itr++) { @@ -1096,8 +1095,6 @@ void processcustomizationfile(const std::string &now_string, assert (GLOBAL_earned_late_days.size() == 0 || tmp > GLOBAL_earned_late_days.back()); GLOBAL_earned_late_days.push_back(tmp); } - } else if (token == "iclicker_ids") { - iclicker_remotes_filename = itr.value().get(); } else if (token == "iclicker") { for (nlohmann::json::iterator itr2 = (itr.value()).begin(); itr2 != (itr.value()).end(); itr2++) { std::string temp = itr2.key(); @@ -1225,7 +1222,6 @@ void processcustomizationfile(const std::string &now_string, LoadExamSeatingFile(GLOBAL_EXAM_SEATING_COUNT,GLOBAL_EXAM_SEATING,GLOBAL_SEATING_SPACING,GLOBAL_LEFT_RIGHT_HANDEDNESS,students); } MakeRosterFile(students); - MatchClickerRemotes(students, iclicker_remotes_filename); AddClickerScores(students,iclicker_questions); } @@ -1287,18 +1283,20 @@ void load_student_grades(std::vector &students) { // non gradeables if (token == "user_id") { s->setUserName(j[token].get()); - } else if (token == "legal_first_name") { + } else if (token == "legal_first_name" || token == "legal_given_name") { s->setLegalFirstName(j[token].get()); - } else if (token == "legal_last_name") { + } else if (token == "legal_last_name" || token == "legal_family_name") { s->setLegalLastName(j[token].get()); - } else if (token == "preferred_first_name") { + } else if (token == "preferred_first_name" || token == "preferred_given_name") { if (!j[token].is_null()) { s->setPreferredFirstName(j[token].get()); } - } else if (token == "preferred_last_name") { + } else if (token == "preferred_last_name" || token == "preferred_family_name") { if (!j[token].is_null()) { s->setPreferredLastName(j[token].get()); } + } else if (token == "user_numeric_id") { + s->setNumericID(j[token].get()); } else if (token == "last_update") { s->setLastUpdate(j[token].get()); } else if (token == "registration_section") { diff --git a/output.cpp b/output.cpp index 2a1dcb4..957d79f 100644 --- a/output.cpp +++ b/output.cpp @@ -541,6 +541,10 @@ void SelectBenchmarks(std::vector &select_students, const std::vector &students, int rank, int month, int day, int year, Student *sp, Student *sa, Student *sb, Student *sc, Student *sd, bool csv_mode) { @@ -552,6 +556,11 @@ void start_table_output( bool /*for_instructor*/, Table table; + GLOBAL_EWS_OUTPUT = std::ofstream("ews_output.txt"); + assert (GLOBAL_EWS_OUTPUT.good()); + + GLOBAL_GRADES_OUTPUT = std::ofstream("grades_output.txt"); + assert (GLOBAL_GRADES_OUTPUT.good()); // ===================================================================================================== // ===================================================================================================== @@ -565,6 +574,7 @@ void start_table_output( bool /*for_instructor*/, table.set(0,counter++,TableCell("ffffff","notes")); } student_data.push_back(counter); table.set(0,counter++,TableCell("ffffff","USERNAME")); + student_data.push_back(counter); table.set(0,counter++,TableCell("ffffff","NUMERIC ID")); if (DISPLAY_INSTRUCTOR_NOTES || DISPLAY_FINAL_GRADE) { table.set(0,counter++,TableCell("ffffff","LAST (LEGAL)")); table.set(0,counter++,TableCell("ffffff","FIRST (LEGAL)")); @@ -791,8 +801,52 @@ void start_table_output( bool /*for_instructor*/, std::vector ews = this_student->getEarlyWarnings(); for (std::size_t i = 0; i < ews.size(); i++) { notes += ews[i]; + + //std::cout << "FOUND EWS " << this_student->getUserName() << ews[i] << std::endl; + } std::string other_note = this_student->getOtherNote(); + + // TEMPORARY placeholder code until course section is added + std::string crn = "99999"; + if (this_student->getSection() == "1") crn = "55037"; + if (this_student->getSection() == "2") crn = "57469"; + if (this_student->getSection() == "3") crn = "55038"; + if (this_student->getSection() == "4") crn = "57234"; + if (this_student->getSection() == "5") crn = "56274"; + if (this_student->getSection() == "6") crn = "55039"; + if (this_student->getSection() == "7") crn = "55328"; + if (this_student->getSection() == "8") crn = "57673"; + if (this_student->getSection() == "9") crn = "57871"; + if (this_student->getSection() == "10")crn = "58089"; + + if (other_note != "" && other_note.find("EWS2") != std::string::npos) { + + std::string category = "FAILING"; + if (other_note.find("TEST") != std::string::npos) { category="TEST_PERFORMANCE"; } + if (other_note.find("HW") != std::string::npos) { category="MISSING_INCOMPLETE_HW"; } + if (other_note.find("ATTENDANCE") != std::string::npos) { category="ATTENDANCE"; } + + GLOBAL_EWS_OUTPUT << this_student->getSection() << "," + << crn << "," << this_student->getUserName() << "," + << this_student->getNumericID() << "," + << category << "," << other_note << std::endl; + + } + + std::string student_grade = this_student->grade(false,sd); + + if (this_student->getSection() != "null" && + this_student->getSection() != "STAFF" && + this_student->getSection() != "ALAC" + ) { + + GLOBAL_GRADES_OUTPUT << this_student->getSection() << "," + << crn << "," << this_student->getUserName() << "," + << this_student->getNumericID() << "," + << student_grade << std::endl; + } + std::string recommendation = this_student->getRecommendation(); std::string THING; if(!csv_mode) { @@ -803,6 +857,7 @@ void start_table_output( bool /*for_instructor*/, } else{ THING = notes + " " + other_note + " " + recommendation; + } assert (default_color.size()==6); table.set(myrow,counter++,TableCell(default_color,THING)); @@ -811,6 +866,7 @@ void start_table_output( bool /*for_instructor*/, //counter+=3; assert (default_color.size()==6); table.set(myrow,counter++,TableCell(default_color,this_student->getUserName())); + table.set(myrow,counter++,TableCell(default_color,this_student->getNumericID())); if (DISPLAY_INSTRUCTOR_NOTES || DISPLAY_FINAL_GRADE) { table.set(myrow,counter++,TableCell(default_color,this_student->getLastName())); table.set(myrow,counter++,TableCell(default_color,this_student->getFirstName())); diff --git a/student.cpp b/student.cpp index 3cdef3b..6311614 100644 --- a/student.cpp +++ b/student.cpp @@ -38,7 +38,7 @@ Student::Student() { cached_hw = -1; // other grade-like data - // (remote id defaults to empty vector) + numeric_id = ""; academic_integrity_form = false; participation = 0; understanding = 0; @@ -379,7 +379,7 @@ float Student::overall_b4_moss() const { return answer; } -std::string Student::grade(bool flag_b4_moss, Student */*lowest_d*/) const { +std::string Student::grade(bool flag_b4_moss, Student *lowest_d) const { if (section == "null") return ""; @@ -395,7 +395,7 @@ std::string Student::grade(bool flag_b4_moss, Student */*lowest_d*/) const { // (instructor can override with manual grade) //Old (pre Su2019) DS method - /*int failed_lab = (GradeablePercent(GRADEABLE_ENUM::LAB) < 1.01 * lowest_d->GradeablePercent(GRADEABLE_ENUM::LAB) ) ? true : false; + int failed_lab = (GradeablePercent(GRADEABLE_ENUM::LAB) < 1.01 * lowest_d->GradeablePercent(GRADEABLE_ENUM::LAB) ) ? true : false; int failed_hw = (GradeablePercent(GRADEABLE_ENUM::HOMEWORK) < 0.95 * lowest_d->GradeablePercent(GRADEABLE_ENUM::HOMEWORK) ) ? true : false; int failed_testA = (GradeablePercent(GRADEABLE_ENUM::TEST) < 0.90 * lowest_d->GradeablePercent(GRADEABLE_ENUM::TEST) ) ? true : false; int failed_testB = (GradeablePercent(GRADEABLE_ENUM::EXAM) < 0.90 * lowest_d->GradeablePercent(GRADEABLE_ENUM::EXAM) ) ? true : false; @@ -405,24 +405,25 @@ std::string Student::grade(bool flag_b4_moss, Student */*lowest_d*/) const { ( failed_testA + failed_testB + failed_testC ) > 1) { - //std::cout << "SHOULD AUTO FAIL"; + std::cout << "SHOULD AUTO FAIL"; - //((Student*)this)->other_note += "SHOULD AUTO FAIL"; + ((Student*)this)->other_note += "SHOULD AUTO FAIL"; return "F"; - }*/ - + } + /* for(std::map::const_iterator it=OVERALL_FAIL_CUTOFFS.begin(); it != OVERALL_FAIL_CUTOFFS.end(); it++){ if(GradeablePercent(it->first)/100.0 < GRADEABLES[it->first].getPercent() * it->second){ - /*std::cerr << "Failing student " << this->getUserName() << " due to low " << gradeable_to_string(it->first) - << " grade of " << GradeablePercent(it->first)/100.0 << " < " - << GRADEABLES[it->first].getPercent() * it->second << " max is " - << GRADEABLES[it->first].getPercent() << std::endl;*/ + std::cerr << "Failing student " << this->getUserName() << " due to low " << gradeable_to_string(it->first) + << " grade of " << GradeablePercent(it->first)/100.0 << " < " + << GRADEABLES[it->first].getPercent() * it->second << " max is " + << GRADEABLES[it->first].getPercent() << std::endl; return "F"; } } - + */ + // otherwise apply the cutoffs if (over >= CUTOFFS["A"]) return "A"; if (over >= CUTOFFS["A-"]) return "A-"; diff --git a/student.h b/student.h index 4d9f170..0ac2622 100644 --- a/student.h +++ b/student.h @@ -105,13 +105,13 @@ class Student { int getDefaultAllowedLateDays() const { return default_allowed_late_days; } void add_bonus_late_day(int which_lecture) { - std::cout << "ADD BONUS " << which_lecture << " " << username << std::endl; + //std::cout << "ADD BONUS " << which_lecture << " " << username << std::endl; bonus_late_days_which_lecture.push_back(which_lecture); } bool get_bonus_late_day(int which_lecture) const { for (unsigned int i = 0; i < bonus_late_days_which_lecture.size(); i++) { if (bonus_late_days_which_lecture[i] == which_lecture) { - std::cout << "YES BONUS " << which_lecture << " " << username << std::endl; + //std::cout << "YES BONUS " << which_lecture << " " << username << std::endl; return true; } } @@ -119,7 +119,7 @@ class Student { } // other grade-like data - const std::vector& getRemoteID() const { return remote_id; } + const std::string& getNumericID() const { return numeric_id; } bool getAcademicIntegrityForm() const { return academic_integrity_form; } float getParticipation() const { return participation; } float getUnderstanding() const { return understanding; } @@ -165,7 +165,7 @@ class Student { void mossify(const std::string &gradeable, float penalty); // other grade-like data - void setRemoteID(const std::string& r_id) { remote_id.push_back(r_id); } + void setNumericID(const std::string& r_id) { numeric_id = r_id; } void setAcademicIntegrityForm() { academic_integrity_form = true; } void setParticipation(float x) { participation = x; } void setUnderstanding(float x) { understanding = x; } @@ -246,7 +246,7 @@ class Student { int rank; // other grade-like data - std::vector remote_id; + std::string numeric_id; bool academic_integrity_form; float participation; float understanding; diff --git a/submini_polls.cpp b/submini_polls.cpp index 92b94b8..72d59a8 100644 --- a/submini_polls.cpp +++ b/submini_polls.cpp @@ -242,8 +242,8 @@ void SavePollReports(const std::vector &students) { tm local_tm = *localtime(&tt); std::stringstream ss; ss << local_tm.tm_year + 1900 << "-" - << std::setw(2) << std::setfill('-') << local_tm.tm_mon + 1 << "-" - << std::setw(2) << std::setfill('-') << local_tm.tm_mday; + << std::setw(2) << std::setfill('0') << local_tm.tm_mon + 1 << "-" + << std::setw(2) << std::setfill('0') << local_tm.tm_mday; std::string today_string = ss.str(); std::cout << "TODAY " << today_string << std::endl; diff --git a/zone.cpp b/zone.cpp index 937fa65..89a3303 100644 --- a/zone.cpp +++ b/zone.cpp @@ -169,7 +169,11 @@ void LoadExamSeatingFile(const std::string &zone_counts_filename, std::getline(istr_zone_counts,line); if (istr_zone_counts.eof()) break; //std::cout << "LINE " << line << std::endl; + if (line[0] == '#') continue; + + if (line == "SKIP") break; + if (line.size() == 0) continue; std::stringstream ss(line); if (line.substr(0,4) == "zone") {