From b6cb4ea7de676e07b6b3752dc2a65a5f23f535d5 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 14 May 2024 06:48:46 +0300 Subject: [fix] gnosis-algorithm-next-interval: adjust for 0 & initial interv If last-interval is 0, use 1 instead. 0 value could possible occur with customized initial interval values. Until 2 successful, have next interval be 0 (review on the same day) upon failure to recall --- gnosis-algorithm.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gnosis-algorithm.el') diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el index 86a997d..075e669 100644 --- a/gnosis-algorithm.el +++ b/gnosis-algorithm.el @@ -184,10 +184,15 @@ successful reviews." ;; 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)) (interval (cond ((and (= successful-reviews 0) success) (car initial-interval)) ((and (= successful-reviews 1) success) (cadr initial-interval)) + ;; If it's still on initial stage, review the + ;; same day + ((and (< successful-reviews 2) (not success)) 0) (t (let* ((success-interval (* ef last-interval)) (failure-interval (* last-interval failure-factor))) (if success success-interval -- cgit v1.2.3