Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature:RainbowGrades] Adding link to gradeable #81

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
using base_url
  • Loading branch information
oliiso committed Jul 30, 2024
commit 1f32c8b92fae188d0c4dc5991b5249499860c040
17 changes: 15 additions & 2 deletions output.cpp
Original file line number Diff line number Diff line change
@@ -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 {
@@ -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 = "<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 "