aboutsummaryrefslogtreecommitdiff
path: root/module/calp/html/view/calendar.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-08 18:07:49 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-08 18:07:49 +0100
commite48fac299412ab4e3ff5e59439c4262473f040f0 (patch)
treec675ffd4b12370a4c127eebab60b01cc71652935 /module/calp/html/view/calendar.scm
parentdoc updates. (diff)
downloadcalp-e48fac299412ab4e3ff5e59439c4262473f040f0.tar.gz
calp-e48fac299412ab4e3ff5e59439c4262473f040f0.tar.xz
Fix flat event slice for calendars.
As noted in the fidd, our simple filter-sorted-stream on event-overlaps? missbehaves in some edge cases. The new system "should" work *fingers crossed*.
Diffstat (limited to 'module/calp/html/view/calendar.scm')
-rw-r--r--module/calp/html/view/calendar.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm
index 727fd8ba..82cccdf3 100644
--- a/module/calp/html/view/calendar.scm
+++ b/module/calp/html/view/calendar.scm
@@ -355,12 +355,16 @@
(id "xcal-data"))
,((@ (vcomponent xcal output) ns-wrap)
(map (@ (vcomponent xcal output) vcomponent->sxcal)
+ ;; A simple filter-sorted-stream on event-overlaps? here fails. See tests/annoying-events.scm
(stream->list
- (filter-sorted-stream
+ (stream-filter
(lambda (ev)
((@ (vcomponent datetime) event-overlaps?)
ev start-date
(date+ end-date (date day: 1))))
- events))))))
+ (stream-take-while (lambda (ev) (date<
+ (as-date (prop ev 'DTSTART))
+ (date+ end-date (date day: 1))))
+ events)))))))
))