mirror of
https://github.com/quatalog/quatalog.git
synced 2024-11-26 00:33:24 +00:00
ITEC -> ITWS
This commit is contained in:
parent
58c7f1beeb
commit
098c89a31c
|
@ -163,6 +163,8 @@ std::string fix_course_ids(std::string course) {
|
||||||
course[4] = '-';
|
course[4] = '-';
|
||||||
if(course.substr(0,3) == "STS") {
|
if(course.substr(0,3) == "STS") {
|
||||||
course[3] = 'O';
|
course[3] = 'O';
|
||||||
|
} else if(course.substr(0,4) == "ITEC") {
|
||||||
|
course.replace(0,4,"ITWS");
|
||||||
}
|
}
|
||||||
return course;
|
return course;
|
||||||
}
|
}
|
||||||
|
@ -185,34 +187,48 @@ 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) {
|
||||||
course_id[4] = '-';
|
course_id[4] = '-';
|
||||||
if(course_id.substr(0,3) != "STS") {
|
if(course_id.substr(0,4) == "STSO") {
|
||||||
return data[course_id];
|
std::cerr<<"course id: "<<course_id<<std::endl;
|
||||||
}
|
const auto& stso = data[course_id];
|
||||||
const auto& stso = data[course_id];
|
course_id[3] = 'S';
|
||||||
course_id[3] = 'S';
|
const auto& stss = data[course_id];
|
||||||
const auto& stss = data[course_id];
|
course_id[3] = 'H';
|
||||||
course_id[3] = 'H';
|
const auto& stsh = data[course_id];
|
||||||
const auto& stsh = data[course_id];
|
|
||||||
|
|
||||||
Json::Value out;
|
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())
|
if(out[key].isObject()) out[key]["prefix"] = "STSH";
|
||||||
out[key]["prefix"] = "STSH";
|
}
|
||||||
}
|
for(const auto& key : stss.getMemberNames()) {
|
||||||
for(const auto& key : stss.getMemberNames()) {
|
out[key] = stss[key];
|
||||||
out[key] = stss[key];
|
if(out[key].isObject()) out[key]["prefix"] = "STSS";
|
||||||
if(out[key].isObject())
|
}
|
||||||
out[key]["prefix"] = "STSS";
|
for(const auto& key : stso.getMemberNames()) {
|
||||||
}
|
out[key] = stso[key];
|
||||||
for(const auto& key : stso.getMemberNames()) {
|
if(out[key].isObject()) out[key]["prefix"] = "STSO";
|
||||||
out[key] = stso[key];
|
}
|
||||||
if(out[key].isObject())
|
return out;
|
||||||
out[key]["prefix"] = "STSO";
|
} else if(course_id.substr(0,4) == "ITWS") {
|
||||||
}
|
const auto& itws = data[course_id];
|
||||||
|
course_id.replace(0,4,"ITEC");
|
||||||
|
const auto& itec = data[course_id];
|
||||||
|
|
||||||
return out;
|
Json::Value out;
|
||||||
|
|
||||||
|
for(const auto& key : itec.getMemberNames()) {
|
||||||
|
out[key] = itec[key];
|
||||||
|
if(out[key].isObject()) out[key]["prefix"] = "ITEC";
|
||||||
|
}
|
||||||
|
for(const auto& key : itws.getMemberNames()) {
|
||||||
|
out[key] = itws[key];
|
||||||
|
if(out[key].isObject()) out[key]["prefix"] = "ITWS";
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
} else {
|
||||||
|
return data[course_id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_course_page(const std::string& course_id,
|
void generate_course_page(const std::string& course_id,
|
||||||
|
|
Loading…
Reference in a new issue