fix sorting issue
This commit is contained in:
parent
688c5faed1
commit
e82ea910ab
@ -410,6 +410,17 @@ pub async fn get_class_timetable(_conn: DbConn, class: String, url: String) -> T
|
|||||||
dbg!("Failed: {:?}", &i);
|
dbg!("Failed: {:?}", &i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
response.courses.sort_by(|a, b| {
|
||||||
|
let n1 = a.as_object().unwrap().get("St").unwrap().as_i64().unwrap();
|
||||||
|
let sb1 = a.as_object().unwrap().get("Fa").unwrap().as_str().unwrap();
|
||||||
|
let n2 = b.as_object().unwrap().get("St").unwrap().as_i64().unwrap();
|
||||||
|
let sb2 = b.as_object().unwrap().get("Fa").unwrap().as_str().unwrap();
|
||||||
|
if n1 == n2 {
|
||||||
|
sb1.cmp(&sb2)
|
||||||
|
} else {
|
||||||
|
n1.cmp(&n2)
|
||||||
|
}
|
||||||
|
});
|
||||||
response.count = response.courses.len();
|
response.count = response.courses.len();
|
||||||
} else if class == String::from("12")
|
} else if class == String::from("12")
|
||||||
&& i.as_object()
|
&& i.as_object()
|
||||||
|
Reference in New Issue
Block a user