Compare commits

..

No commits in common. "bdfcc61dd2796d17041ce4585d2fc29c0db49224" and "e9627e69fda0603e4bf83222135ddd8afbd282fb" have entirely different histories.

View File

@ -805,30 +805,29 @@ PARAMS is a property list of the following parameters:
(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))
(format-time-string timestamp-format start-date))) (format-time-string timestamp-format start-date)))
(insert "| End Time | Planned Work | Work Hours | Utilization |\n| <r> | <r> | <r> | <r> |\n|---|\n") (insert "| End Time | Planned Total | Utilization |\n| <r> | <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;
(let ((total-work-hours 0)) ;; XXX: this might be slow, try to reduce the calls to `db/org-planned-tasks-in-range'.
(let ((days 0))
(dolist (interval-end-date date-range) (dolist (interval-end-date date-range)
(let* ((total-time-duration (car ;; XXX: this might be slow, try to reduce the calls to (let ((total-time (car (db/org-planned-tasks-in-range
;; `db/org-planned-tasks-in-range'. ;; Set start date to nil to also include tasks scheduled or deadlined
(db/org-planned-tasks-in-range ;; before `start-date', as those are also still open and need to be
;; Set start date to nil to also include tasks scheduled or ;; done somewhen.
;; deadlined before `start-date', as those are also still open nil
;; and need to be done somewhen. interval-end-date
nil org-ql-match))))
interval-end-date (let ((utilization (* (/ (org-duration-to-minutes total-time)
org-ql-match))) (* (cl-incf days)
(utilization (* (/ (org-duration-to-minutes total-time-duration) (org-duration-to-minutes work-hours)))
(cl-incf total-work-hours (org-duration-to-minutes work-hours))) 100)))
100))) (insert (format "| [%s] | %s | %s |\n"
(insert (format "| [%s] | %s | %s | %s |\n" interval-end-date
interval-end-date total-time
total-time-duration (if (<= 80 utilization)
(org-duration-from-minutes total-work-hours) ;; When utilization is above 80%, mark entry in bold
(if (<= 80 utilization) (format "*%.2f%%*" utilization)
;; When utilization is above 80%, mark entry in bold (format "%.2f%%" utilization))))))))
(format "*%.2f%%*" utilization)
(format "%.2f%%" utilization)))))))
(insert "|--|") (insert "|--|")
(org-table-align))) (org-table-align)))