Sort category overview in timeline tools by total amount

Nice to read, I think.
This commit is contained in:
Daniel Borchmann 2024-10-25 19:16:25 +02:00
parent 2c0f2f2ab5
commit 8a3bba0afe
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625

View File

@ -490,7 +490,9 @@ current values of the relevant buffer local variables."
-sum))))))
(total-time (float (-sum (-map #'-second-item data)))))
(insert "| Category | Total | Amount |\n|--|\n")
(dolist (category-lines data)
(dolist (category-lines (-sort #'(lambda (entry-1 entry-2) ; sort output by booked time
(>= (-second-item entry-1) (-second-item entry-2)))
data))
(insert (format "| %s | %s | %.2f%% |\n"
(-first-item category-lines)
(org-duration-from-minutes (-second-item category-lines))