From 050ef8fba20e3a8a3222760951766549849921ee Mon Sep 17 00:00:00 2001 From: Sophia Oliinik Date: Thu, 8 Aug 2024 10:44:26 -0700 Subject: [PATCH] term and course update --- output.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/output.cpp b/output.cpp index f514468..53fa8bf 100644 --- a/output.cpp +++ b/output.cpp @@ -138,11 +138,14 @@ int convertMajor(const std::string &major) { else return 10; } -std::string getBaseUrl() { +std::tuple getCourseDetails() { std::ifstream i("/var/local/submitty/courses/f24/sample/reports/base_url.json"); nlohmann::json j; i >> j; - return j["base_url"].get(); + std::string baseUrl = j["base_url"].get(); + std::string term = j["term"].get(); + std::string course = j["course"].get(); + return {baseUrl, term, course}; } // ========================================================== @@ -645,12 +648,10 @@ void start_table_output( bool /*for_instructor*/, if (g != GRADEABLE_ENUM::NOTE) { student_data.push_back(counter); } + auto [base_url, semester, course] = getCourseDetails(); std::string gradeable_id = GRADEABLES[g].getID(j); std::string gradeable_name = ""; - std::string base_url = getBaseUrl(); - std::string semester = "f24/"; - std::string course = "sample"; - std::string fullUrl = base_url + "courses/" + semester + course + "/gradeable/" + gradeable_id; + std::string fullUrl = base_url + "courses/" + semester + "/" + course + "/gradeable/" + gradeable_id; if (GRADEABLES[g].hasCorrespondence(gradeable_id)) { gradeable_name = GRADEABLES[g].getCorrespondence(gradeable_id).second;