summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-05-10 14:00:38 +0300
committerThanos Apollo <[email protected]>2024-05-10 14:00:38 +0300
commited098f3db517b83e0655cab74c89b49f7b47e8ad (patch)
treed9b94654388f464b0bc0bb145302bc0841c53276
parentbd9de41126d8752d48d38b5b9b3680ef0cd6b735 (diff)
[fix] gnosis-algorithm-next-interval: use min upon failure
Adjust so that failure-interval is never higher than success-interval, such us in cases where initial-interval is used
-rw-r--r--gnosis-algorithm.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el
index ad663e4..4cfebd1 100644
--- a/gnosis-algorithm.el
+++ b/gnosis-algorithm.el
@@ -183,9 +183,12 @@ successful reviews."
(car initial-interval))
((and (= successful-reviews 1) success)
(cadr initial-interval))
- (t (if success
- (* ef last-interval)
- (* failure-factor last-interval))))))
+ (t (let* ((success-interval (* ef last-interval))
+ (failure-interval (* last-interval failure-factor)))
+ (if success success-interval
+ ;; Make sure failure interval is never
+ ;; higher than success
+ (min success-interval failure-interval)))))))
(gnosis-algorithm-date (round interval))))