Show music lessons properly

This commit is contained in:
powe97 2024-03-15 23:46:28 -04:00
parent 517952f977
commit 77423ec069
No known key found for this signature in database
GPG key ID: 7D1663B10978D1BA
2 changed files with 16 additions and 5 deletions

View file

@ -239,7 +239,15 @@ void handle_everything(const Json::Value& sections,
const Json::Value& term_prereqs) {
Json::Value& course_term = course_terms[term];
const auto& course_id = course["id"].asString();
course_term["title"] = course["title"];
// course_term["title"] = course["title"];
std::set<std::string> titles;
for(const auto& sec : course["sections"]) {
titles.insert(sec["title"].asString());
}
course_term["title"] = Json::arrayValue;
for(const auto& title : titles) {
course_term["title"].append(title);
}
handle_sections(sections,course_term);
course_terms["latest_term"] = term;
handle_attributes(sections[0],course_id,course_term,out_prereqs);

View file

@ -417,7 +417,7 @@ void generate_table_cell(const int year,
std::ostream& os) {
std::string year_term = std::to_string(year) + term_to_number.at(term);
const auto& term_offered = terms_offered[year_term];
const auto& course_title = term_offered["title"].asString();
const auto& course_titles = term_offered["title"];
const auto& credit_string = generate_credit_string(term_offered["credits"]);
tag(os,TAG::COMPLEX_BEGIN) << R"(<td )";
@ -437,11 +437,14 @@ void generate_table_cell(const int year,
<< "&subj_in=" << term_offered["prefix"].asString()
<< "&crse_in=" << course_id.substr(5,4)
<< "&schd_in="
<< R"(">)" << course_title << " (" << credit_string << "c)</a>";
<< R"(">)" << course_titles[0].asString() << " (" << credit_string << "c)";
for(const auto& attr : term_offered["attributes"]) {
os << ' ' << attr.asString();
}
os << '\n';
for(int i = 1; i < course_titles.size(); i++) {
os << "<br>" << course_titles[i].asString();
}
os << "</a>" << '\n';
tag(os,TAG::END,"span");
tag(os,TAG::BEGIN,R"(ul class="prof-list")");
@ -547,7 +550,7 @@ get_course_title_and_description(const std::string& course_id,
if(catalog_entry) {
title = catalog_entry["name"].asString();
} else {
title = terms_offered[latest_term]["title"].asString();
title = terms_offered[latest_term]["title"][0].asString();
}
if(catalog_entry) {
description = catalog_entry["description"].asString();