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 all commits
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
14 changes: 14 additions & 0 deletions output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ int convertMajor(const std::string &major) {
else return 10;
}

std::tuple<std::string, std::string, std::string> getCourseDetails() {
std::ifstream i("/var/local/submitty/courses/f24/sample/reports/base_url.json");
nlohmann::json j;
i >> j;
std::string baseUrl = j["base_url"].get<std::string>();
std::string term = j["term"].get<std::string>();
std::string course = j["course"].get<std::string>();
return {baseUrl, term, course};
}

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

class Color {
Expand Down Expand Up @@ -638,11 +648,15 @@ 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 fullUrl = base_url + "courses/" + semester + "/" + course + "/gradeable/" + gradeable_id;

if (GRADEABLES[g].hasCorrespondence(gradeable_id)) {
gradeable_name = GRADEABLES[g].getCorrespondence(gradeable_id).second;
//gradeable_name = spacify(gradeable_name);
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