From 9b8b9704b7ae1bf4aa15ae0121fe79fa9a743316 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 27 May 2024 06:01:42 +0300 Subject: [fix] gnosis-review-last-interval: Minimum value to return is 1 Returning 0 would break algorithm implementation --- gnosis.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnosis.el b/gnosis.el index bb2422c..bf67962 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1127,7 +1127,7 @@ well." (let* ((where-id-clause `(= id ,id)) (last-rev (gnosis-get 'last-rev 'review-log where-id-clause)) (rev-date (gnosis-get 'next-rev 'review-log where-id-clause))) - (gnosis-algorithm-date-diff last-rev rev-date))) + (max (gnosis-algorithm-date-diff last-rev rev-date) 1))) (defun gnosis-review-algorithm (id success) "Return next review date & ef for note with value of id ID. -- cgit v1.2.3 From 0d66e03b1e4ad7c06e235eb199fa18cf4e7cb7fb Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 27 May 2024 06:02:48 +0300 Subject: [fix] gnosis-algorithm: Use notes total-ef --- gnosis-algorithm.el | 5 +---- gnosis.el | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el index 075e669..33e3232 100644 --- a/gnosis-algorithm.el +++ b/gnosis-algorithm.el @@ -182,10 +182,7 @@ reviews. Will be used to determine the next interval for the first 2 successful reviews." (cl-assert (< gnosis-algorithm-ff 1) "Value of `gnosis-algorithm-ff' must be lower than 1") ;; This should only occur in testing env or when the user has made breaking changes. - (cl-assert (> (nth 2 ef) 1) "Total ef value must be above 1") - (let* ((ef (nth 2 gnosis-algorithm-ef)) - ;; If last-interval is 0, use 1 instead. - (last-interval (if (<= last-interval 0) 1 last-interval)) + (let* ((last-interval (if (<= last-interval 0) 1 last-interval)) ;; If last-interval is 0, use 1 instead. (interval (cond ((and (= successful-reviews 0) success) (car initial-interval)) ((and (= successful-reviews 1) success) diff --git a/gnosis.el b/gnosis.el index bf67962..5480a4d 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1145,7 +1145,7 @@ Returns a list of the form ((yyyy mm dd) (ef-increase ef-decrease ef-total))." ;; (last-interval (max (gnosis-review--get-offset id) 1)) (last-interval (gnosis-review-last-interval id))) ;; last interval (list (gnosis-algorithm-next-interval :last-interval last-interval - :ef ef + :ef (nth 2 ef) ;; total ef is used for next interval :success success :successful-reviews t-success :failure-factor ff -- cgit v1.2.3