summaryrefslogtreecommitdiff
path: root/gnosis-algorithm.el
diff options
context:
space:
mode:
Diffstat (limited to 'gnosis-algorithm.el')
-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))))