Make skip-matches also skip computations in workload overview report
This avoids unnecessary computations.
This commit is contained in:
parent
46797626e3
commit
f948f3dca3
@ -777,16 +777,18 @@ PARAMS is a property list of the following parameters:
|
|||||||
;; Compute range of dates to check; simple but potentially costly approach
|
;; Compute range of dates to check; simple but potentially costly approach
|
||||||
;; taken from https://sachachua.com/blog/2015/08/org-mode-date-arithmetic/;
|
;; taken from https://sachachua.com/blog/2015/08/org-mode-date-arithmetic/;
|
||||||
;; maybe consider `org-read-date-get-relative' as well?
|
;; maybe consider `org-read-date-get-relative' as well?
|
||||||
(let ((current start-date))
|
(let ((current start-date)
|
||||||
|
current-formatted)
|
||||||
(while (or (time-less-p current end-date)
|
(while (or (time-less-p current end-date)
|
||||||
(time-equal-p current end-date))
|
(time-equal-p current end-date))
|
||||||
(setq current (org-read-date t t
|
(setq current (org-read-date t t
|
||||||
;; Add an extra + to ensure we increase the
|
;; Add an extra + to ensure we increase the amount of time
|
||||||
;; amount of time relative to the given
|
;; relative to the given default time string.
|
||||||
;; default time string.
|
|
||||||
(format "+%s" increment)
|
(format "+%s" increment)
|
||||||
nil current))
|
nil current)
|
||||||
(push current date-range)))
|
current-formatted (format-time-string timestamp-format current))
|
||||||
|
(unless (funcall skipper current-formatted)
|
||||||
|
(push current-formatted date-range))))
|
||||||
(setq date-range (nreverse (cdr date-range)))
|
(setq date-range (nreverse (cdr 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"
|
||||||
@ -794,20 +796,16 @@ PARAMS is a property list of the following parameters:
|
|||||||
(format-time-string timestamp-format start-date)))
|
(format-time-string timestamp-format start-date)))
|
||||||
(insert "| End Time | Planned Total |\n| <r> | <r> |\n|---|\n")
|
(insert "| End Time | Planned Total |\n| <r> | <r> |\n|---|\n")
|
||||||
;; Compute workload report for each date and record the total time;
|
;; Compute workload report for each date and record the total time;
|
||||||
;; XXX: this might be slow, try to reduce the calls to
|
;; XXX: this might be slow, try to reduce the calls to `db/org-planned-tasks-in-range'.
|
||||||
;; `db/org-planned-tasks-in-range'.
|
|
||||||
(dolist (interval-end-date date-range)
|
(dolist (interval-end-date date-range)
|
||||||
(let ((total-time (car (db/org-planned-tasks-in-range
|
(let ((total-time (car (db/org-planned-tasks-in-range
|
||||||
;; Set start date to nil to also include tasks
|
;; Set start date to nil to also include tasks scheduled or deadlined
|
||||||
;; scheduled or deadlined before `start-date', as
|
;; before `start-date', as those are also still open and need to be
|
||||||
;; those are also still open and need to be done
|
;; done somewhen.
|
||||||
;; somewhen.
|
|
||||||
nil
|
nil
|
||||||
(format-time-string timestamp-format interval-end-date)
|
interval-end-date
|
||||||
org-ql-match))))
|
org-ql-match))))
|
||||||
(let ((interval-end-date (format-time-string timestamp-format interval-end-date)))
|
(insert (format "| [%s] | %s |\n" interval-end-date total-time))))
|
||||||
(unless (funcall skipper interval-end-date)
|
|
||||||
(insert (format "| [%s] | %s |\n" interval-end-date total-time))))))
|
|
||||||
(insert "|--|")
|
(insert "|--|")
|
||||||
(org-table-align)))
|
(org-table-align)))
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user