diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-10-05 23:51:50 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-10-05 23:51:50 +0200 |
commit | 1bc8f0c31fd94b3936fc13ed325ecd8308d73f87 (patch) | |
tree | c9217c0daf92743b903685dd19eda1288c6ad9e6 /module/vcomponent | |
parent | HTML output seems to work in full now. (diff) | |
download | calp-1bc8f0c31fd94b3936fc13ed325ecd8308d73f87.tar.gz calp-1bc8f0c31fd94b3936fc13ed325ecd8308d73f87.tar.xz |
Fix day-stream, and in effect terminal output.
Diffstat (limited to '')
-rw-r--r-- | module/vcomponent/group.scm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/module/vcomponent/group.scm b/module/vcomponent/group.scm index 41123126..7733d981 100644 --- a/module/vcomponent/group.scm +++ b/module/vcomponent/group.scm @@ -5,7 +5,7 @@ #:use-module (srfi srfi-19 util) #:use-module (srfi srfi-41) #:use-module (srfi srfi-41 util) - #:export (group-stream)) + #:export (group-stream get-groups-between)) ;; TODO templetize this (define-stream (group-stream in-stream) @@ -16,7 +16,8 @@ (if (stream-null? stream) stream-null (let* ((day (stream-car days)) - (tomorow (add-day (date->time-utc (drop-time day))))) + (tomorow (date->time-utc (stream-car (stream-cdr days))))) + (let ((head (stream-take-while (ein? day) stream)) (tail (filter-sorted-stream* @@ -24,11 +25,12 @@ (lambda (e) (time<=? tomorow (attr e 'DTSTART))) stream))) + (stream-cons (cons day head) (loop (stream-cdr days) tail))))))) -(define-public (get-groups-between groups start-date end-date) +(define (get-groups-between groups start-date end-date) (filter-sorted-stream ;; TODO in-date-range? drops the first date (compose (in-date-range? start-date end-date) |