IHSS -> INQR (why)

This commit is contained in:
powe97 2023-07-27 18:12:44 -04:00
parent f9a10a59dd
commit 779b596d63

View file

@ -165,6 +165,8 @@ std::string fix_course_ids(std::string course) {
course[3] = 'O';
} else if(course.substr(0,4) == "ITEC") {
course.replace(0,4,"ITWS");
} else if(course.substr(0,4) == "IHSS") {
course.replace(0,4,"INQR");
}
return course;
}
@ -221,6 +223,19 @@ Json::Value get_data(const Json::Value& data,
out[key] = itws[key];
if(out[key].isObject()) out[key]["prefix"] = "ITWS";
}
} else if(course_id.substr(0,4) == "INQR") {
const auto& inqr = data[course_id];
course_id.replace(0,4,"IHSS");
const auto& ihss = data[course_id];
for(const auto& key : inqr.getMemberNames()) {
out[key] = inqr[key];
if(out[key].isObject()) out[key]["prefix"] = "INQR";
}
for(const auto& key : ihss.getMemberNames()) {
out[key] = ihss[key];
if(out[key].isObject()) out[key]["prefix"] = "IHSS";
}
} else {
out = data[course_id];
for(const auto& key : out.getMemberNames()) {