fix for 2022-2023 semester 1

This commit is contained in:
Mylloon 2022-08-30 21:06:44 +02:00
parent 8b6daaab3a
commit fb21d3eece
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -50,6 +50,7 @@ pub async fn timetable(
// For each days // For each days
let mut timetable = Vec::new(); let mut timetable = Vec::new();
let span_regex = Regex::new(r"<span.*</span>").unwrap();
for day in raw_timetable_values.select(&sel_tr) { for day in raw_timetable_values.select(&sel_tr) {
let mut courses_vec = Vec::new(); let mut courses_vec = Vec::new();
let mut location_tracker = 0; let mut location_tracker = 0;
@ -60,12 +61,9 @@ pub async fn timetable(
} else { } else {
courses_vec.push(Some(models::Course { courses_vec.push(Some(models::Course {
name: match course.select(&sel_em).next() { name: match course.select(&sel_em).next() {
Some(value) => value.inner_html(), Some(value) => span_regex.replace(&value.inner_html(), " ").to_string(),
None => course None => span_regex
.inner_html() .replace(course.inner_html().split("<br>").next().unwrap(), " ")
.split("<br>")
.next()
.unwrap()
.to_string(), .to_string(),
}, },
professor: match course professor: match course