summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnosis-algorithm.el19
-rw-r--r--gnosis.el8
2 files changed, 17 insertions, 10 deletions
diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el
index 3295e50..fee5624 100644
--- a/gnosis-algorithm.el
+++ b/gnosis-algorithm.el
@@ -91,7 +91,7 @@ The structure of the given date is (YEAR MONTH DAY)."
(+ ef (car gnosis-algorithm-ef)))
(t (error "Invalid quality score passed to gnosis-algorithm-e-factor"))))
-(defun gnosis-algorithm-next-interval (last-interval n ef success ff)
+(defun gnosis-algorithm-next-interval (last-interval n ef success ff successful-reviews)
"Calculate next interval.
- LAST-INTERVAL : The number of days since the item was last reviewed.
- N : Number of times the item has been reviewed.
@@ -111,11 +111,18 @@ Returns a tuple: (INTERVAL N EF) where,
;; Calculate the next interval.
(interval
(cond
- ;; Immediately next day if it's the first time review.
- ((<= n 1) (car gnosis-algorithm-interval))
- ;; After 3 days if it's second review.
- ((= n 2) (cadr gnosis-algorithm-interval))
- ;; Increase last interval by 1 if recall was successful. Keep last interval if unsuccessful.
+ ;; First successful review -> first interval
+ ((and (= successful-reviews 0)
+ (= success 1))
+ (car gnosis-algorithm-interval))
+ ;; Second successful review -> second interval
+ ((and (= successful-reviews 1)
+ (= success 1))
+ (cadr gnosis-algorithm-interval))
+ ;; TESTING
+ ((and (= last-interval 0)
+ (= success 1))
+ (* ef 1))
(t (if (= success 1)
(* ef last-interval)
(* ff last-interval))))))
diff --git a/gnosis.el b/gnosis.el
index 4ae140e..eee497e 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -271,18 +271,18 @@ choice in the `CHOICES' list. Each note must correspond to one `DECK'.
new string)))
string)
;; Review
+;;;;;;;;;;
(defun gnosis-review--algorithm (id success)
"Get next review date & ef for note with value of id ID.
SUCCESS is a binary value, 1 = success, 0 = failure.
Returns a list of the form ((yyyy mm dd) ef)."
(let ((ff gnosis-algorithm-ff)
- (ef (nth 2 (gnosis-get 'ef 'review `(= id ,id)))))
+ (ef (nth 2 (gnosis-get 'ef 'review `(= id ,id))))
+ (c-success (gnosis-get 'c-success 'review-log `(= id ,id))))
(gnosis-algorithm-next-interval (gnosis-review--get-offset id)
(gnosis-get 'n 'review-log `(= id ,id))
- ef
- success
- ff)))
+ ef success ff c-success)))
(defun gnosis-review-get-due-notes ()
"Get due notes id for current date.