From 113f3f4495d9988e5e3036b0a593de8c84f24b6a Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Wed, 24 May 2023 19:25:02 +0200 Subject: [PATCH] Fix invalid logic for nil dates in workload report When not provided in dynamic workload reports, `start-date` and `end-date` should be treated as unconstrainted. However, instead dates were queried interactively in that case, because `org-read-date` is being used to normalize date display. Fixed that. --- site-lisp/db-org.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 50bde9c..ada0d94 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -611,14 +611,18 @@ everything understood by `org-read-date'." (string-replace ">" "]")) ""))) - (insert (format "#+CAPTION: Workload Report at %s for [%s]--[%s] .\n" + (insert (format "#+CAPTION: Workload Report at %s from %s until %s.\n" (with-temp-buffer ;; Is there an easier way to get the current time as an ;; inactive timestamp? (org-insert-time-stamp (current-time) t t) (buffer-string)) - (org-read-date nil nil start-date) - (org-read-date nil nil end-date))) + (if start-date + (format "[%s]" (org-read-date nil nil start-date)) + "The Beginning Of Time") + (if end-date + (format "[%s]" (org-read-date nil nil end-date)) + "The End of Things"))) (insert "| Task | Effort | Timestamp | SCHEDULED | DEADLINE |\n|---|\n") (pcase-dolist (`(,task-id . ,effort-string) (cdr task-summary)) (insert (format "| %s | %s | %s | %s | %s |\n"