aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2022-02-05 15:14:26 +0100
committerAlban Gruin2022-02-05 15:18:19 +0100
commitee3b01bf7027798ba23153aef7f4ccc57f5f7b38 (patch)
treee6cfa8c92a91c8daa21ef711dec5e572bffb61ad
parent216ca76fc3518d5369b3501822a22cd712dec548 (diff)
ics: introduce functions to filter courses without location
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
-rw-r--r--src/ics.ml5
-rw-r--r--src/ics.mli1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ics.ml b/src/ics.ml
index 5afff39..be7fb18 100644
--- a/src/ics.ml
+++ b/src/ics.ml
@@ -73,10 +73,15 @@ module Event = struct
found || List.exists ((=) group) groups) false event.groups
let get_groups event = event.groups
+
+ let has_no_locations event =
+ event.location = None
end
type t = Event.t list
+let filter_empty_locations =
+ List.filter (Event.has_no_locations)
let filter_groups groups =
List.filter (Event.has_groups groups)
diff --git a/src/ics.mli b/src/ics.mli
index 575e88e..e3dd577 100644
--- a/src/ics.mli
+++ b/src/ics.mli
@@ -26,6 +26,7 @@ end
type t = Event.t list
+val filter_empty_locations : t -> t
val filter_groups : string list -> t -> t
val get_all_groups : t -> string Seq.t
val to_string : string -> t -> string