From 1cab8ef246fd266fe1bbe88d3ba588bf9f512b8c Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 13 Sep 2024 19:27:29 +0200 Subject: [PATCH] trim class from courses name (#9) --- src/timetable.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/timetable.rs b/src/timetable.rs index fe0fba0..d56bf92 100644 --- a/src/timetable.rs +++ b/src/timetable.rs @@ -90,10 +90,13 @@ pub async fn timetable( [models::Category::Cours].into() }, }, - name: matches - .name("name") - .unwrap() - .as_str().to_owned(), + name: Regex::new(r"[ -][ML][1-3]$").unwrap().replace( + matches + .name("name") + .unwrap() + .as_str(), + "" + ).to_string(), professor: if let Some(raw_prof) = i.select(&sel_small).last() { match raw_prof.inner_html() { i if i.starts_with(" None,