From 7f2d3ccf617f6ee6b91cdd2a66251be6ad9cdbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 23 Apr 2019 17:22:58 +0200 Subject: 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. --- module/html/html.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/html/html.scm') 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")) -- cgit v1.2.3