diff options
| author | Alban Gruin | 2020-10-03 16:29:37 +0200 | 
|---|---|---|
| committer | Alban Gruin | 2020-10-03 16:29:37 +0200 | 
| commit | 7a3cd6d029e73a28e1229ac24edb4c5bd87162b9 (patch) | |
| tree | 488fb8efa502dd00c91bfe9b190eee983a21da7a | |
| parent | d036a80e83789485235375078f7df972f20286a2 (diff) | |
course: remove reference to unused fields in the original JSON feed
It's cleaner to merge an actual obj with a unit instead of refering to
every field in the JSON feed, and makes the schema more flexible.
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
| -rw-r--r-- | src/course.ml | 25 | 
1 files changed, 5 insertions, 20 deletions
| diff --git a/src/course.ml b/src/course.ml index aede83e..52aa062 100644 --- a/src/course.ml +++ b/src/course.ml @@ -90,35 +90,20 @@ let date =  let encoding =    J.(conv -       (fun _ -> (None, None, "", "", (), (), ()), -                 ((), (), (), (), (), (), (), (), (), ())) -       (fun ((start, stop, description, category, (), (), ()), -             ((), (), (), (), (), (), (), (), (), ())) -> +       (fun _ -> (None, None, "", ""), ()) +       (fun ((start, stop, description, category), ()) ->           let location, summary = location_and_summary description category in           match start, stop with           | Some start, Some stop ->              Some (Ics.Event.make start stop summary location)           | _, _ -> None)         (merge_objs -          (obj7 +          (obj4               (req "start" @@ option date)               (req "end" @@ option date)               (req "description" string) -             (req "eventCategory" string) -             (req "id" unit) -             (req "allDay" unit) -             (req "backgroundColor" unit)) -          (obj10 -             (req "textColor" unit) -             (req "department" unit) -             (req "faculty" unit) -             (req "sites" unit) -             (req "modules" unit) -             (req "registerStatus" unit) -             (req "studentMark" unit) -             (req "custom1" unit) -             (req "custom2" unit) -             (req "custom3" unit)))) +             (req "eventCategory" string)) +          unit))  let decode s =    let toks = | 
