Why do I do this to myself
This commit is contained in:
parent
098c89a31c
commit
3aa7aaa509
|
@ -186,6 +186,7 @@ bool create_dir_if_not_exist(const fs::path& path) {
|
||||||
|
|
||||||
Json::Value get_data(const Json::Value& data,
|
Json::Value get_data(const Json::Value& data,
|
||||||
std::string course_id) {
|
std::string course_id) {
|
||||||
|
Json::Value out;
|
||||||
course_id[4] = '-';
|
course_id[4] = '-';
|
||||||
if(course_id.substr(0,4) == "STSO") {
|
if(course_id.substr(0,4) == "STSO") {
|
||||||
std::cerr<<"course id: "<<course_id<<std::endl;
|
std::cerr<<"course id: "<<course_id<<std::endl;
|
||||||
|
@ -195,8 +196,6 @@ Json::Value get_data(const Json::Value& data,
|
||||||
course_id[3] = 'H';
|
course_id[3] = 'H';
|
||||||
const auto& stsh = data[course_id];
|
const auto& stsh = data[course_id];
|
||||||
|
|
||||||
Json::Value out;
|
|
||||||
|
|
||||||
for(const auto& key : stsh.getMemberNames()) {
|
for(const auto& key : stsh.getMemberNames()) {
|
||||||
out[key] = stsh[key];
|
out[key] = stsh[key];
|
||||||
if(out[key].isObject()) out[key]["prefix"] = "STSH";
|
if(out[key].isObject()) out[key]["prefix"] = "STSH";
|
||||||
|
@ -209,14 +208,11 @@ Json::Value get_data(const Json::Value& data,
|
||||||
out[key] = stso[key];
|
out[key] = stso[key];
|
||||||
if(out[key].isObject()) out[key]["prefix"] = "STSO";
|
if(out[key].isObject()) out[key]["prefix"] = "STSO";
|
||||||
}
|
}
|
||||||
return out;
|
|
||||||
} else if(course_id.substr(0,4) == "ITWS") {
|
} else if(course_id.substr(0,4) == "ITWS") {
|
||||||
const auto& itws = data[course_id];
|
const auto& itws = data[course_id];
|
||||||
course_id.replace(0,4,"ITEC");
|
course_id.replace(0,4,"ITEC");
|
||||||
const auto& itec = data[course_id];
|
const auto& itec = data[course_id];
|
||||||
|
|
||||||
Json::Value out;
|
|
||||||
|
|
||||||
for(const auto& key : itec.getMemberNames()) {
|
for(const auto& key : itec.getMemberNames()) {
|
||||||
out[key] = itec[key];
|
out[key] = itec[key];
|
||||||
if(out[key].isObject()) out[key]["prefix"] = "ITEC";
|
if(out[key].isObject()) out[key]["prefix"] = "ITEC";
|
||||||
|
@ -225,10 +221,11 @@ Json::Value get_data(const Json::Value& data,
|
||||||
out[key] = itws[key];
|
out[key] = itws[key];
|
||||||
if(out[key].isObject()) out[key]["prefix"] = "ITWS";
|
if(out[key].isObject()) out[key]["prefix"] = "ITWS";
|
||||||
}
|
}
|
||||||
return out;
|
|
||||||
} else {
|
} else {
|
||||||
return data[course_id];
|
out = data[course_id];
|
||||||
|
out[key]["prefix"] = course_id.substr(0,4);
|
||||||
}
|
}
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_course_page(const std::string& course_id,
|
void generate_course_page(const std::string& course_id,
|
||||||
|
@ -435,7 +432,7 @@ void generate_table_cell(const int year,
|
||||||
tag(os,TAG::BEGIN,R"(span class="term-course-info")");
|
tag(os,TAG::BEGIN,R"(span class="term-course-info")");
|
||||||
tag(os,TAG::INLINE) << R"(<a href="https://sis.rpi.edu/rss/bwckctlg.p_disp_listcrse?term_in=)"
|
tag(os,TAG::INLINE) << R"(<a href="https://sis.rpi.edu/rss/bwckctlg.p_disp_listcrse?term_in=)"
|
||||||
<< year << term_to_number_no_half.at(term)
|
<< year << term_to_number_no_half.at(term)
|
||||||
<< "&subj_in=" << (course_id.substr(0,3) != "STS" ? course_id.substr(0,4) : term_offered["prefix"].asString())
|
<< "&subj_in=" << term_offered["prefix"].asString()
|
||||||
<< "&crse_in=" << course_id.substr(5,4)
|
<< "&crse_in=" << course_id.substr(5,4)
|
||||||
<< "&schd_in="
|
<< "&schd_in="
|
||||||
<< R"(">)" << course_title << " (" << credit_string << "c)</a>";
|
<< R"(">)" << course_title << " (" << credit_string << "c)</a>";
|
||||||
|
|
Loading…
Reference in New Issue