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.
This commit is contained in:
Daniel Borchmann 2024-12-04 16:23:05 +01:00
parent fd3b43bee0
commit bac4fb389a
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625

View File

@ -812,7 +812,11 @@ PARAMS is a property list of the following parameters:
current-formatted (format-time-string timestamp-format current)) current-formatted (format-time-string timestamp-format current))
(unless (funcall skip-date-p current-formatted) (unless (funcall skip-date-p current-formatted)
(push (cons current current-formatted) date-range)))) (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" (insert (format "#+CAPTION: Workload Overview Report at [%s] with start date [%s]\n"
(format-time-string timestamp-format (current-time)) (format-time-string timestamp-format (current-time))