aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/instance/methods.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/vcomponent/instance/methods.scm')
-rw-r--r--module/vcomponent/instance/methods.scm19
1 files changed, 12 insertions, 7 deletions
diff --git a/module/vcomponent/instance/methods.scm b/module/vcomponent/instance/methods.scm
index 4baf9409..ea3522f9 100644
--- a/module/vcomponent/instance/methods.scm
+++ b/module/vcomponent/instance/methods.scm
@@ -54,13 +54,18 @@
(slot-set! this 'calendars (load-calendars (slot-ref this 'calendar-files)))
- (slot-set! this 'events
- (concatenate
- (map (lambda (cal) (remove
- (extract 'X-HNH-REMOVED)
- (filter (lambda (o) (eq? 'VEVENT (type o)))
- (children cal))))
- (slot-ref this 'calendars))))
+
+ (let* ((groups
+ (group-by
+ type (concatenate
+ (map children (slot-ref this 'calendars)))))
+ (events (awhen (assoc-ref groups 'VEVENT)
+ (car it)))
+ (removed remaining (partition (extract 'X-HNH-REMOVED) events)))
+
+ ;; TODO figure out what to do with removed events
+
+ (slot-set! this 'events (append #|removed|# remaining)))
(let* ((repeating regular (partition repeating? (slot-ref this 'events))))
(slot-set! this 'fixed-events (sort*! regular date/-time<? (extract 'DTSTART)))