Add caption with time for workload reports

Those reports are only relevant when known when they have been generated.

This is similar to the caption added to dynamic clocktable blocks.
This commit is contained in:
Daniel - 2023-01-12 16:21:43 +01:00
parent 2423dcf6cd
commit f534833520
Signed by: dbo
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 15 additions and 1 deletions

View File

@ -501,6 +501,14 @@ understood by `org-read-date'."
(string-replace ">" "]"))
"")))
(insert (format "#+CAPTION: Workload Report at %s for [%s]--[%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)))
(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"
@ -608,10 +616,16 @@ PARAMS is a property list of the following parameters:
(org-time-string-to-time current))))
(setq date-range (nreverse date-range))
(insert (format "#+CAPTION: Workload Overview Report at %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))))
(insert "| Until | Planned Total |\n| <r> | <r> |\n|---|\n")
;; Compute workload report for each date and record the total time; XXX:
;; this might be slow, try to reduce the calls to
;; `db/org-planned-tasks-in-range'.
(insert "| Until | Planned Total |\n| <r> | <r> |\n|---|\n")
(dolist (interval-end-date date-range)
(let ((total-time (car (db/org-planned-tasks-in-range start-date
interval-end-date