diff --git a/src/main.rs b/src/main.rs index ad1cfa7..b15c720 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,6 @@ async fn main() -> Result<(), Box> { for time in raw_schedules.select(&sel_th) { schedules.push(time.inner_html()); } - println!("{:#?}", schedules); // Find the timetable values let raw_timetable_values = raw_timetable.select(&sel_tbody).next().unwrap(); @@ -58,9 +57,25 @@ async fn main() -> Result<(), Box> { courses: courses_vec, }) } - println!("{:#?}", timetable); // 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(()) } + +/// Check if the timetable is well built +fn check_timetable_consistency(schedules: &Vec, timetable: &Vec) -> 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 +}