This commit is contained in:
Mylloon 2024-12-12 09:42:59 +01:00
parent c0023d3a83
commit 400a927ce1
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -177,16 +177,16 @@ pub fn build(timetable: &models::Timetable, dates: &Info) -> Vec<models::Course>
&schedules, &schedules,
&timetable.1 .1, &timetable.1 .1,
&datetimes.course, &datetimes.course,
&Some(vec![models::Category::Cours]), Some(&vec![models::Category::Cours]),
&None, None,
); );
add_courses( add_courses(
&mut semester, &mut semester,
&schedules, &schedules,
&timetable.1 .1, &timetable.1 .1,
&datetimes.td_tp, &datetimes.td_tp,
&None, None,
&Some(vec![models::Category::Cours]), Some(&vec![models::Category::Cours]),
); );
semester semester
@ -205,9 +205,9 @@ fn add_courses(
// Current courses list // Current courses list
info: &InfoList, info: &InfoList,
// List of category allowed // List of category allowed
keep: &Option<Vec<models::Category>>, keep: Option<&Vec<models::Category>>,
// List of category excluded // List of category excluded
exclude: &Option<Vec<models::Category>>, exclude: Option<&Vec<models::Category>>,
) { ) {
let before_break = info.first().unwrap(); let before_break = info.first().unwrap();
let mut date = before_break.0; let mut date = before_break.0;
@ -224,9 +224,8 @@ fn add_courses(
// Check keep and exclude filters // Check keep and exclude filters
if keep if keep
.clone()
.is_some_and(|list| !course.category.iter().any(|item| list.contains(item))) .is_some_and(|list| !course.category.iter().any(|item| list.contains(item)))
|| exclude.clone().is_some_and(|list| { || exclude.is_some_and(|list| {
course.category.iter().any(|item| list.contains(item)) course.category.iter().any(|item| list.contains(item))
}) })
{ {