From be6755a94a24d5685ffa0a87a89c8df4416bdaca Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 23 Dec 2023 14:00:55 +0200 Subject: Add updates for successful reviews & add note-count - Add note-count for gnosis-review, output total number of notes reviewed for session. This could also be tracked to keep track progress - Upon review update db for last-rev, next-rev and the new-ef. This function may change to just gnosis-review--update, where based on an argument updates db for failed/successful review --- gnosis.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gnosis.el b/gnosis.el index c3bad78..e6ceb36 100644 --- a/gnosis.el +++ b/gnosis.el @@ -172,7 +172,7 @@ Returns a list of the form ((yyyy mm dd) ef)." success ff))) -(defun gnosis-review--get-due-notes () +(defun gnosis-review-get-due-notes () "Get due notes for current date." (gnosis--select 'id 'review-log `(<= next-rev ',(gnosis-algorithm-date)))) @@ -193,10 +193,13 @@ SUCCESS is a binary value, 1 = success, 0 = failure." (defun gnosis-review--success (id) "Update review-log for note with value of id ID." - (let ((ef (gnosis-review--new-ef id 1))) - ;; (gnosis-update 'review-log `(= last-rev ',(gnosis-algorithm-date)) `(= id ,id)) + (let ((ef (gnosis-review-new-ef id 1))) + ;; Update review-log + (gnosis-update 'review-log `(= last-rev ',(gnosis-algorithm-date)) `(= id ,id)) (gnosis-update 'review-log `(= next-rev ',(car (gnosis-review--algorithm id 1))) `(= id ,id)) - (gnosis-update 'review `(= ef ,ef) `(= id ,id)))) + (gnosis-update 'review-log `(= n (+ 1 ,(gnosis-get 'n 'review-log `(= id ,id)))) `(= id ,id)) + ;; Update review + (gnosis-update 'review `(= ef ',ef) `(= id ,id)))) (cl-defun gnosis-review-update--last-rev (id) "Update last-rev, from review-log, for note with value of id ID. @@ -228,7 +231,8 @@ Change last-rev to current date." (defun gnosis-review () "Start gnosis session." (interactive) - (let ((due-notes (gnosis-review--get-due-notes))) + (let ((due-notes (gnosis-review-get-due-notes)) + (note-count 0)) (if (null due-notes) (message "No due notes.") (cl-loop for note in due-notes -- cgit v1.2.3