From bac4fb389a8bb2c888c26eb12db92d2dd908d156 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Wed, 4 Dec 2024 16:23:05 +0100 Subject: [PATCH] Fix handling of last day in workload overview report Previously, the last day added had been removed on the assumption that it was the frist day after `end-date` (after which the while loop aborts). However, when this last day is filtered because of `:skip-matches`, this would result in accidentally removing a valid day from the overview time period. This has been fixed by checking for this very case, and keeping the last day added in case it is still within the requested time period. --- site-lisp/db-org.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 54fa7c1..01d0a87 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -812,7 +812,11 @@ PARAMS is a property list of the following parameters: current-formatted (format-time-string timestamp-format current)) (unless (funcall skip-date-p current-formatted) (push (cons current current-formatted) date-range)))) - (setq date-range (nreverse (cdr date-range))) + + ;; Remove last day added when outside of range; reverse range afterwards to get correct sorting + (setq date-range (nreverse (if (time-less-p end-date (caar date-range)) + (cdr date-range) + date-range))) (insert (format "#+CAPTION: Workload Overview Report at [%s] with start date [%s]\n" (format-time-string timestamp-format (current-time))