This commit is contained in:
Mylloon 2024-09-13 19:23:00 +02:00
parent 090a16433d
commit b621436483
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -71,9 +71,9 @@ pub async fn timetable(
.capitalize(); .capitalize();
let startime = matches let startime = matches
.name("startime") .name("startime")
.unwrap() .unwrap()
.as_str(); .as_str();
let binding = i.select(&sel_b).last().unwrap().inner_html(); let binding = i.select(&sel_b).last().unwrap().inner_html();
let course = models::Course{ let course = models::Course{
@ -91,21 +91,21 @@ pub async fn timetable(
}, },
}, },
name: matches name: matches
.name("name") .name("name")
.unwrap() .unwrap()
.as_str().to_owned(), .as_str().to_owned(),
professor: if let Some(raw_prof) = i.select(&sel_small).last() { professor: if let Some(raw_prof) = i.select(&sel_small).last() {
match raw_prof.inner_html() { match raw_prof.inner_html() {
i if i.starts_with("<span") => None, i if i.starts_with("<span") => None,
i => Some(i), i => Some(i),
} }
} else { None }, } else { None },
room: Regex::new(r"(<table.*<\/table>|<br>.*?<br>.*?)?<br>(?P<location>.*?)<br>") room: Regex::new(r"(<table.*<\/table>|<br>.*?<br>.*?)?<br>(?P<location>.*?)<br>")
.unwrap() .unwrap()
.captures(&binding) .captures(&binding)
.unwrap().name("location") .unwrap().name("location")
.unwrap() .unwrap()
.as_str().to_owned(), .as_str().to_owned(),
start: schedules.iter().position(|r| r.starts_with(startime)).unwrap(), start: schedules.iter().position(|r| r.starts_with(startime)).unwrap(),
size: i.value().attr("rowspan").unwrap().parse::<usize>().unwrap(), size: i.value().attr("rowspan").unwrap().parse::<usize>().unwrap(),
dtstart: None, dtstart: None,