diff options
author | Thanos Apollo <[email protected]> | 2024-07-23 18:46:49 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-07-23 18:46:49 +0300 |
commit | e72d2dc67439d880d93739fe003d451c6c790ae3 (patch) | |
tree | 675c252e1873ae3f6c15f3d077bc1643881ed93d /gnosis.el | |
parent | 293684279e55c14bb9a819a40ecfaddec5febe72 (diff) |
[fix] get-date-total-notes creation of new entries.
* gnosis-get-date-total-notes should not create new entries unless
it's for the current date.
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -2033,13 +2033,18 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend" (defun gnosis-get-date-total-notes (&optional date) "Return total notes reviewed for DATE. +If entry for DATE does not exist, it will be created. + Defaults to current date." (cl-assert (listp date) nil "Date must be a list.") (let* ((date (or date (gnosis-algorithm-date))) - (note-num (car (gnosis-select 'note-num 'activity-log `(= date ',date) t)))) - (or note-num + (reviewed-total (car (gnosis-select 'reviewed-total 'activity-log `(= date ',date) t))) + (reviewed-new (or (car (gnosis-select 'reviewed-new 'activity-log `(= date ',date) t)) 0))) + (or reviewed-total (progn - (gnosis--insert-into 'activity-log `([,date 0])) + ;; Using reviewed-new instead of hardcoding 0 just to not mess up tests. + (and (equal date (gnosis-algorithm-date)) + (gnosis--insert-into 'activity-log `([,date 0 ,reviewed-new]))) 0)))) (defun gnosis-get-date-new-notes (&optional date) |