Skip to content

Commit

Permalink
using base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
oliiso committed Jul 30, 2024
1 parent 5bb168a commit 1f32c8b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>();
}

// ==========================================================

class Color {
Expand Down Expand Up @@ -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++) {
Expand All @@ -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 = "<a href=\"" + gradeable_url + "\" style=\"color:black;\">" + gradeable_name + "&nbsp;&nbsp; <i class='fas fa-external-link-alt'></i></a>";
gradeable_name = "<a href=\"" + fullUrl + "\" style=\"color:black;\">" + gradeable_name + "&nbsp;&nbsp; <i class='fas fa-external-link-alt'></i></a>";
}
if (gradeable_name == "")
gradeable_name = "<em><font color=\"aaaaaa\">future "
Expand Down

0 comments on commit 1f32c8b

Please sign in to comment.