diff --git a/output.cpp b/output.cpp index 8028197..41de966 100644 --- a/output.cpp +++ b/output.cpp @@ -138,6 +138,13 @@ int convertMajor(const std::string &major) { else return 10; } +std::string getBaseUrl() { + std::ifstream i("/var/local/submitty/courses/f24/sample/reports/base_url.json"); + nlohmann::json j; + i >> j; + return j["base_url"].get(); +} + // ========================================================== class Color { @@ -632,6 +639,7 @@ void start_table_output( bool /*for_instructor*/, // ---------------------------- // DETAILS OF EACH GRADEABLE if (DISPLAY_GRADE_DETAILS) { + Student* this_student = new Student(); for (unsigned int i = 0; i < ALL_GRADEABLES.size(); i++) { GRADEABLE_ENUM g = ALL_GRADEABLES[i]; for (int j = 0; j < GRADEABLES[g].getCount(); j++) { @@ -640,11 +648,16 @@ void start_table_output( bool /*for_instructor*/, } std::string gradeable_id = GRADEABLES[g].getID(j); std::string gradeable_name = ""; - std::string gradeable_url = "https://submitty.org/grading_details/" + gradeable_id; + std::string section = ""; + std::string base_url = getBaseUrl(); + std::string gradeable_url = base_url + gradeable_id; + std::string fullUrl = base_url + "/" + section + "/gradeable/" + gradeable_id; + if (GRADEABLES[g].hasCorrespondence(gradeable_id)) { gradeable_name = GRADEABLES[g].getCorrespondence(gradeable_id).second; + section = this_student->getSection(); //gradeable_name = spacify(gradeable_name); - gradeable_name = "" + gradeable_name + "   "; + gradeable_name = "" + gradeable_name + "   "; } if (gradeable_name == "") gradeable_name = "future "