diff --git a/main.cpp b/main.cpp index 52b9b5a..b1c63ae 100644 --- a/main.cpp +++ b/main.cpp @@ -1320,7 +1320,12 @@ void load_student_grades(std::vector &students) { a = "null"; } s->setSection(a); - + } else if (token == "rotating_section") { + int a = -1; + if (!j[token].is_null()) { + a = j[token].get(); + } + s->setRotatingSection(a); } else if (token == "default_allowed_late_days") { int value = 0; if (!j[token].is_null()) { @@ -1776,6 +1781,35 @@ void initialize_time(std::string &now_string, int &year, int &month, int &day) { } +void loadAllowedLateDays(std::vector &students) { + std::ifstream istr("polls/late_days.csv"); + if (!istr.good()) return; + std::string s; + while (istr >> s) { + int x = s.find(','); + std::string username = s.substr(0,x); + s = s.substr(x+1,100); + + x = s.find(','); + std::string date = s.substr(0,x); + s = s.substr(x+1,100); + + int allowed = std::stoi(s); + + //std::cout << "foo " << s << " --- " << username << " - " <getUserName() == username) { + s->setCurrentAllowedLateDays(allowed); + break; + } + } + + } +} + + int main(int argc, char* argv[]) { //std::string sort_order = "by_overall"; @@ -1793,6 +1827,8 @@ int main(int argc, char* argv[]) { std::vector students; processcustomizationfile(now_string,students); + loadAllowedLateDays(students); + // ====================================================================== // SUGGEST CURVES suggest_curves(students); diff --git a/output.cpp b/output.cpp index 94659c3..7d471dd 100644 --- a/output.cpp +++ b/output.cpp @@ -160,6 +160,7 @@ std::string coloritcolor(float val, //check for nan if (val != val) return "ffffff"; if (std::isinf(val)) return "00ff00"; + if (std::isnan(perfect)) return "00ff00"; //std::cout << "coloritcolor " << val << " " << perfect << " " << a << " " << b << " " << c << " " << d << std::endl; assert (perfect >= a && @@ -1163,8 +1164,17 @@ void start_table_output( bool for_instructor, void end_table(std::ofstream &ostr, bool for_instructor, Student *s) { + ostr << "

* = 1 late day used

" << std::endl; - ostr << "

* = 1 late day used

" << std::endl; + if (s != NULL) { + std::ifstream istr("polls/student_files/"+s->getUserName()+".html"); + if (istr.good()) { + std::string tmp_s; + while (getline(istr,tmp_s)) { + ostr << tmp_s; + } + } + } if (GLOBAL_instructor_output == false && DISPLAY_ICLICKER) { diff --git a/student.cpp b/student.cpp index 5bfc438..0c89bb2 100644 --- a/student.cpp +++ b/student.cpp @@ -29,6 +29,7 @@ Student::Student() { } // (iclicker defaults to empty map) + rotating_section = -1; zones = std::vector(GRADEABLES[GRADEABLE_ENUM::TEST].getCount(),""); moss_penalty = 0; cached_hw = -1; diff --git a/student.h b/student.h index 0be14a8..527e06c 100644 --- a/student.h +++ b/student.h @@ -85,6 +85,7 @@ class Student { // registration status const std::string& getSection() const { return section; } + int getRotatingSection() const { return rotating_section; } bool getAudit() const { return audit; } bool getWithdraw() const { return withdraw; } bool getIndependentStudy() const { return independentstudy; } @@ -138,6 +139,7 @@ class Student { // registration status void setSection(std::string x) { section = x; } + void setRotatingSection(int x) { rotating_section = x; } void setAudit() { audit = true; } void setWithdraw() { withdraw = true; } void setIndependentStudy() { independentstudy = true; } @@ -213,6 +215,7 @@ class Student { // registration status std::string section; + int rotating_section; bool audit; bool withdraw; bool independentstudy;