Modified jm/scorecard to allow daily, weekly, and monthly scores

This commit is contained in:
Random936 2024-02-22 15:54:52 -08:00
parent f35ed556ec
commit 44fa73e897
2 changed files with 20 additions and 11 deletions

View File

@ -129,17 +129,22 @@ Taken from the book /12 Week Year/, the weekly scorecard is a way to measure how
dailies-directory)
dict)))))
(defun jm/weekly-scorecard (&optional days)
(defun jm/scorecard (days)
(interactive)
(let ((table "| Task | Completed | Total | Percentage |\n"))
(dolist (box (jm/n-day-scorecard (or days 7)) table)
(let* ((separator "|---|---|---|---|\n")
(table (concat "| Task | Completed | Total | Percentage |\n" separator))
(checked-sum 0)
(total-sum 0))
(dolist (box (jm/n-day-scorecard days) table)
(let* ((name (car box))
(checked (cadr box))
(total (cadr (cdr box)))
(percentage (/ (float checked) total)))
(setq table
(concat table "| " name " | "
(number-to-string checked) " | "
(number-to-string total) " | "
(number-to-string percentage) " |\n"))))))
(percentage (* (/ (float checked) total) 100)))
(setq total-sum (+ total total-sum)
checked-sum (+ checked checked-sum)
table (format "%s| %s | %d | %d | %d%% |\n"
table name checked total percentage))))
(format "%s%s| Average | %d | %d | %d%% |\n"
table separator checked-sum total-sum
(* (/ (float checked-sum) total-sum) 100))))
#+end_src

View File

@ -258,8 +258,12 @@ Below is the main config for org-roam.
(file ,(expand-file-name "reflection.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t)
("s" "Weekly Scorecard" entry
(file ,(expand-file-name "scorecard.org" jm/org-roam-templates-directory))
("S" "Weekly Scorecard" entry
(file ,(expand-file-name "weekly-scorecard.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t)
("s" "Daily Scorecard" entry
(file ,(expand-file-name "daily-scorecard.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t)
("t" "Todos" entry