Sort days

This commit is contained in:
Mylloon 2024-01-01 12:58:57 +01:00
parent 9ce116f620
commit 862c02b3e7
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -110,6 +110,14 @@ pub async fn timetable(
} }
}); });
// Sort by days
let day_positions = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi"]
.iter()
.enumerate()
.map(|(i, &day)| (day.to_owned(), i))
.collect::<HashMap<String, usize>>();
timetable.sort_by(|a, b| day_positions[&a.name].cmp(&day_positions[&b.name]));
(schedules, (semester as usize, timetable)) (schedules, (semester as usize, timetable))
} }