aboutsummaryrefslogtreecommitdiff
path: root/src/ics.ml
diff options
context:
space:
mode:
authorAlban Gruin2021-09-16 22:11:59 +0200
committerAlban Gruin2021-09-19 12:36:21 +0200
commitcb2f075c326f40c27b4c6d9dde6fd51b78a43f9c (patch)
tree422e65ea254e8c663406b2cf4d776f31f23cf3da /src/ics.ml
parenta5e7ab75ed9ff253df73cf951140748ce41503c4 (diff)
course, ics: read, store, and dump groups in a course
In the future, we want to filter courses by its groups. To allow this, we must parse and store the groups from celcat. This adds this feature. We also dump them in the `COMMENT' field of the iCalendar files. Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
Diffstat (limited to 'src/ics.ml')
-rw-r--r--src/ics.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ics.ml b/src/ics.ml
index d1bb808..f1b6cc5 100644
--- a/src/ics.ml
+++ b/src/ics.ml
@@ -1,5 +1,5 @@
(*
- * Copyright (C) 2020 Alban Gruin
+ * Copyright (C) 2020, 2021 Alban Gruin
*
* ucs is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
@@ -39,10 +39,11 @@ module Event = struct
stop: Calendar.t;
summary: string;
location: string;
+ groups: string list;
}
- let make start stop summary location =
- {start; stop; summary; location}
+ let make start stop summary location groups =
+ {start; stop; summary; location; groups}
let to_string date event id =
["BEGIN:VEVENT";
@@ -51,6 +52,7 @@ module Event = struct
"DTEND:" ^ to_date event.stop;
"DTSTAMP:" ^ date;
"SUMMARY:" ^ event.summary;
+ "COMMENT:" ^ String.concat ", " event.groups;
"LOCATION:" ^ event.location;
"END:VEVENT\n"]
|> List.map ics_split_line