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.
This commit is contained in:
Daniel Borchmann 2023-05-24 19:25:02 +02:00
parent a4712cf155
commit 113f3f4495
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625

View File

@ -611,14 +611,18 @@ everything understood by `org-read-date'."
(string-replace ">" "]")) (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 (with-temp-buffer
;; Is there an easier way to get the current time as an ;; Is there an easier way to get the current time as an
;; inactive timestamp? ;; inactive timestamp?
(org-insert-time-stamp (current-time) t t) (org-insert-time-stamp (current-time) t t)
(buffer-string)) (buffer-string))
(org-read-date nil nil start-date) (if start-date
(org-read-date nil nil end-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") (insert "| Task | Effort | Timestamp | SCHEDULED | DEADLINE |\n|---|\n")
(pcase-dolist (`(,task-id . ,effort-string) (cdr task-summary)) (pcase-dolist (`(,task-id . ,effort-string) (cdr task-summary))
(insert (format "| %s | %s | %s | %s | %s |\n" (insert (format "| %s | %s | %s | %s | %s |\n"