diff options
author | Thanos Apollo <[email protected]> | 2024-07-26 18:04:23 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-07-26 18:04:23 +0300 |
commit | 988b24dd10d5bdb60be76a794a558020f3158ac9 (patch) | |
tree | 5903c5442e0cdd83b2222a1ceeedca96d1b9185f /gnosis-dashboard.el | |
parent | 889a1aa87a5ed46639aa9f1fdb513821c8f68c8f (diff) |
New function: Add dashboard--streak
* Return consecutive review streak.
Diffstat (limited to 'gnosis-dashboard.el')
-rw-r--r-- | gnosis-dashboard.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el index 7b17239..d317ad3 100644 --- a/gnosis-dashboard.el +++ b/gnosis-dashboard.el @@ -80,6 +80,18 @@ do (setq notes (append notes (list (gnosis-get-date-total-notes date))))) notes)) +(defun gnosis-dashboard--streak (dates &optional num date) + "Return current review streak. + +DATES: Dates in the activity log. +NUM: Streak number. +DATE: Integer, used with `gnosis-algorithm-date' to get previous dates." + (let ((num (or num 0)) + (date (or date 0))) + (if (member (gnosis-algorithm-date date) dates) + (gnosis-dashboard--streak dates (cl-incf num) (- date 1)) + num))) + (defun gnosis-dashboard-month-reviews (month) "Return reviewes for MONTH in current year." (cl-assert (and (integerp month) |