aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-04-23 17:22:58 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-04-23 17:24:27 +0200
commit7f2d3ccf617f6ee6b91cdd2a66251be6ad9cdbd9 (patch)
treed2b8a9fd8892b76999dc8b8300b228744adb8e98
parentAdd event-length/day. (diff)
downloadcalp-7f2d3ccf617f6ee6b91cdd2a66251be6ad9cdbd9.tar.gz
calp-7f2d3ccf617f6ee6b91cdd2a66251be6ad9cdbd9.tar.xz
Change event-length => event-length/day.
This fixes a bug where a long event (spanning multiple days) which only had a short part in the current day would still using its whole length when getting sorted to be placed graphically. This limits the length for the sorting to the relevant part of the event.
-rw-r--r--module/html/html.scm6
1 files changed, 3 insertions, 3 deletions
diff --git a/module/html/html.scm b/module/html/html.scm
index afe34963..d7a52a53 100644
--- a/module/html/html.scm
+++ b/module/html/html.scm
@@ -36,7 +36,7 @@
;; Takes a list of vcomponents, sets their widths and x-positions to optimally
;; fill out the space, without any overlaps.
-(define (fix-event-widths! lst)
+(define (fix-event-widths! start-of-day lst)
;; @var{x} is how for left in the container we are.
(define (inner x tree)
@@ -54,7 +54,7 @@
;; event it would capture the longer event to
;; only find events which also overlaps the
;; smaller event.
- (sort* lst time>? event-length))))
+ (sort* lst time>? (lambda (e) (event-length/day e start-of-day))))))
(define (time->decimal-hour time)
"This should only be used on time intervals,
@@ -113,7 +113,7 @@ never on absolute times. For that see date->decimal-hour"
(define (lay-out-day day)
(let* (((date . events) day))
;; (format (current-error-port) "Processing ~a~%" (date->string date))
- (fix-event-widths! (stream->list events))
+ (fix-event-widths! (date->time-utc date) (stream->list events))
`(div (@ (class "day"))
(div (@ (class "meta"))
(span (@ (class "dayname")) ,(date->string date "~a"))