return semester
This commit is contained in:
parent
935ab42e61
commit
10d9904fd7
1 changed files with 8 additions and 2 deletions
|
@ -1,9 +1,15 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use scraper::{Html, Selector};
|
use scraper::{Html, Selector};
|
||||||
|
|
||||||
pub mod models;
|
pub mod models;
|
||||||
|
|
||||||
/// Fetch the timetable for a class
|
/// Fetch the timetable for a class
|
||||||
pub async fn timetable(year: i8, semester: i8, letter: Option<char>) -> Vec<models::Day> {
|
pub async fn timetable(
|
||||||
|
year: i8,
|
||||||
|
semester: i8,
|
||||||
|
letter: Option<char>,
|
||||||
|
) -> HashMap<usize, Vec<models::Day>> {
|
||||||
let document = get_webpage(year, semester, letter)
|
let document = get_webpage(year, semester, letter)
|
||||||
.await
|
.await
|
||||||
.expect("Can't reach timetable website.");
|
.expect("Can't reach timetable website.");
|
||||||
|
@ -94,7 +100,7 @@ pub async fn timetable(year: i8, semester: i8, letter: Option<char>) -> Vec<mode
|
||||||
panic!("Error when building the timetable.");
|
panic!("Error when building the timetable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
timetable
|
HashMap::from([(semester as usize, timetable)])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get timetable webpage
|
/// Get timetable webpage
|
||||||
|
|
Reference in a new issue