Archived
1
0
Fork 0
forked from Anri/cal8tor

wip check timetable consistency

This commit is contained in:
Mylloon 2022-08-13 17:27:35 +02:00
parent d726a7f778
commit 818c8eb40f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -31,7 +31,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
for time in raw_schedules.select(&sel_th) { for time in raw_schedules.select(&sel_th) {
schedules.push(time.inner_html()); schedules.push(time.inner_html());
} }
println!("{:#?}", schedules);
// Find the timetable values // Find the timetable values
let raw_timetable_values = raw_timetable.select(&sel_tbody).next().unwrap(); let raw_timetable_values = raw_timetable.select(&sel_tbody).next().unwrap();
@ -58,9 +57,25 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
courses: courses_vec, courses: courses_vec,
}) })
} }
println!("{:#?}", timetable);
// TODO: Make fn who chacke if timetable is bell built (time consistency) // TODO: Make fn who chacke if timetable is bell built (time consistency)
if !check_timetable_consistency(&schedules, &timetable) {
panic!("Error when building the timetable.");
}
Ok(()) Ok(())
} }
/// Check if the timetable is well built
fn check_timetable_consistency(schedules: &Vec<String>, timetable: &Vec<models::Day>) -> bool {
// No work during week-end
if timetable.len() == 5 {
// TODO: Check if schedules.len() is coherent
// with the values inside the timetable
println!("{:#?}", schedules);
println!("{:#?}", timetable);
return true;
}
false
}