summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-05-14 06:48:46 +0300
committerThanos Apollo <[email protected]>2024-05-14 06:50:31 +0300
commitb6cb4ea7de676e07b6b3752dc2a65a5f23f535d5 (patch)
tree3471a449909f8463d11b0e72b4911611143ab79a
parent1991525161b6fa888839e213fb25d6878a14ffa7 (diff)
[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
-rw-r--r--gnosis-algorithm.el5
1 files changed, 5 insertions, 0 deletions
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