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) dailies-directory)
dict))))) dict)))))
(defun jm/weekly-scorecard (&optional days) (defun jm/scorecard (days)
(interactive) (interactive)
(let ((table "| Task | Completed | Total | Percentage |\n")) (let* ((separator "|---|---|---|---|\n")
(dolist (box (jm/n-day-scorecard (or days 7)) table) (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)) (let* ((name (car box))
(checked (cadr box)) (checked (cadr box))
(total (cadr (cdr box))) (total (cadr (cdr box)))
(percentage (/ (float checked) total))) (percentage (* (/ (float checked) total) 100)))
(setq table (setq total-sum (+ total total-sum)
(concat table "| " name " | " checked-sum (+ checked checked-sum)
(number-to-string checked) " | " table (format "%s| %s | %d | %d | %d%% |\n"
(number-to-string total) " | " table name checked total percentage))))
(number-to-string percentage) " |\n")))))) (format "%s%s| Average | %d | %d | %d%% |\n"
table separator checked-sum total-sum
(* (/ (float checked-sum) total-sum) 100))))
#+end_src #+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)) (file ,(expand-file-name "reflection.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n") :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t) :unnarrowed t)
("s" "Weekly Scorecard" entry ("S" "Weekly Scorecard" entry
(file ,(expand-file-name "scorecard.org" jm/org-roam-templates-directory)) (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") :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t) :unnarrowed t)
("t" "Todos" entry ("t" "Todos" entry