From a55229d34abeb85d9adaca615c9905c7b06a81e1 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sat, 5 Feb 2022 15:16:18 +0100 Subject: Introduce a new feature to list events without location This adds a new page listing events without location. Signed-off-by: Alban Gruin --- src/pages.ml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/pages.ml') diff --git a/src/pages.ml b/src/pages.ml index 6fd7bef..c8f8c2e 100644 --- a/src/pages.ml +++ b/src/pages.ml @@ -147,3 +147,27 @@ let select module_id groups = |} + +let empty_events events = + let format_event name _groups start stop = + let escape () = escape and + to_hour = CalendarLib.Printer.Calendar.sprint "%H:%M" and + to_date = CalendarLib.Printer.Calendar.sprint "%d/%m/%Y" in + Printf.sprintf "
  • %a, le %a de %a à %a
  • " + escape name + escape (to_date start) + escape (to_hour start) + escape (to_hour stop) in + let formatted_events = + match events with + | [] -> "
  • Aucun cours sans salle dans cet emploi du temps.
  • " + | events -> + List.map (Ics.Event.format_fields format_event) events + |> String.concat "\n" in + common @@ {| +

    Liste des cours sans salle

    + +|} -- cgit v1.2.1