Compare commits
2 Commits
986ae68730
...
4706de981b
| Author | SHA1 | Date | |
|---|---|---|---|
| 4706de981b | |||
| cffe713fa9 |
@ -59,7 +59,7 @@ Filter are applied in the order they are given in this list."
|
||||
:group 'timeline-tools
|
||||
:type 'integer)
|
||||
|
||||
(defcustom timeline-tools-headline-time-format "%Y-%m-%d %H:%M"
|
||||
(defcustom timeline-tools-headline-time-format "%Y-%m-%d %a %H:%M"
|
||||
"Format of time used in the headline of a timeline."
|
||||
:group 'timeline-tools
|
||||
:type 'string)
|
||||
@ -433,8 +433,7 @@ interactively, this date will be queried with `org-read-date’.
|
||||
When not given, FILES defaults to `org-agenda-files’ without
|
||||
archives."
|
||||
(interactive (list (org-read-date nil nil)))
|
||||
(let ((timeline-tools-time-format "%H:%M")
|
||||
(timeline-tools-headline-time-format "%Y-%m-%d"))
|
||||
(let ((timeline-tools-time-format "%H:%M"))
|
||||
(timeline-tools-format-timeline (concat date " 00:00")
|
||||
(org-read-date nil nil "++1d" nil
|
||||
(org-time-string-to-time date))
|
||||
@ -458,9 +457,8 @@ current values of the relevant buffer local variables."
|
||||
timeline-tools--current-files)
|
||||
(timeline-tools--get-timeline-from-buffer)))))
|
||||
|
||||
;; Update categories in all affected buffers to retrieve up-to-date
|
||||
;; information; find all relevant buffers by checking the markers of all
|
||||
;; entries.
|
||||
;; Update categories in all affected buffers to retrieve up-to-date information; find all
|
||||
;; relevant buffers by checking the markers of all entries.
|
||||
(dolist (buffer (->> timeline
|
||||
(mapcar #'timeline-tools-entry-marker)
|
||||
(mapcar #'marker-buffer)
|
||||
@ -469,11 +467,35 @@ current values of the relevant buffer local variables."
|
||||
(org-refresh-category-properties)))
|
||||
|
||||
(erase-buffer)
|
||||
(insert (format "* Timeline from [%s] to [%s]\n\n"
|
||||
|
||||
;; Header
|
||||
(insert (format "Timeline from [%s] to [%s]\n\n"
|
||||
(format-time-string timeline-tools-headline-time-format
|
||||
timeline-tools--current-time-start)
|
||||
(format-time-string timeline-tools-headline-time-format
|
||||
timeline-tools--current-time-end)))
|
||||
|
||||
;; Clocktime summary: booked categories, their total times, and their relative amount
|
||||
(let* ((data (->> timeline
|
||||
(-group-by timeline-tools-category-function)
|
||||
(-map #'(lambda (category-lines)
|
||||
(list (car category-lines)
|
||||
(->> category-lines
|
||||
cdr
|
||||
(-map #'timeline-tools-entry-duration)
|
||||
-sum))))))
|
||||
(total-time (float (-sum (-map #'-second-item data)))))
|
||||
(insert "| Category | Total | Amount |\n|--|\n")
|
||||
(dolist (category-lines data)
|
||||
(insert (format "| %s | %s | %.2f%% |\n"
|
||||
(-first-item category-lines)
|
||||
(org-duration-from-minutes (-second-item category-lines))
|
||||
(* 100 (/ (-second-item category-lines) total-time)))))
|
||||
(insert (format "|--|\n| | %s | |\n" (org-duration-from-minutes total-time)))
|
||||
(org-table-align)
|
||||
(insert "\n"))
|
||||
|
||||
;; Actual timeline
|
||||
(insert "|--|\n")
|
||||
(insert "| Category | Start | End | Duration | Task |\n")
|
||||
(let ((last-category nil)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user