diff options
author | Thanos Apollo <[email protected]> | 2024-02-08 18:25:41 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-02-08 18:25:41 +0200 |
commit | 732ee3d5882fdcac7a753afe3030535abdf88912 (patch) | |
tree | 1df52508ac3c90496ad0e1fe48851473c423794f /gnosis.el | |
parent | 1371fb75614e23dc791c452c07e2ca72206383e8 (diff) |
gnosis.el: Refactor for new success value, t or nil
First implementation of gnosis ef was supposed to take a "quality"
value of 0 to 3 for reviews, which was never actually implemented.
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -855,7 +855,8 @@ well." (defun gnosis-review--algorithm (id success) "Return next review date & ef for note with value of id ID. -SUCCESS is a binary value, 1 = success, 0 = failure. +SUCCESS is a boolean value, t for success, nil for 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)))) @@ -890,8 +891,8 @@ such as the easiness factor (ef)." (defun gnosis-review-new-ef (id success) "Return new ef for note with value of id ID. -SUCCESS is a binary value, 1 = success, 0 = failure. -Returns a list of the form (ef-increase ef-decrease ef)." +Returns a list of the form (ef-increase ef-decrease ef). +SUCCESS is a boolean value, t for success, nil for failure." (let ((ef (nth 1 (gnosis-review--algorithm id success))) (old-ef (gnosis-get 'ef 'review `(= id ,id)))) (cl-substitute (gnosis-review-round ef) (nth 2 old-ef) old-ef))) @@ -924,9 +925,9 @@ SUCCESS is a binary value, 1 is for successful review." (user-choice (gnosis-mcq-answer id))) (if (string= answer user-choice) (progn - (gnosis-review--update id 1) + (gnosis-review--update id t) (message "Correct!")) - (gnosis-review--update id 0) + (gnosis-review--update id nil) (message "False")) (gnosis-display-correct-answer-mcq answer user-choice) (gnosis-display-extra id) @@ -942,7 +943,7 @@ SUCCESS is a binary value, 1 is for successful review." (success (gnosis-compare-strings answer user-input))) (gnosis-display-basic-answer answer success user-input) (gnosis-display-extra id) - (gnosis-review--update id (if success 1 0)) + (gnosis-review--update id success) (gnosis-display-next-review id))) (defun gnosis-review-y-or-n (id) @@ -955,7 +956,7 @@ SUCCESS is a binary value, 1 is for successful review." (success (equal answer user-input))) (gnosis-display-y-or-n-answer :answer answer :success success) (gnosis-display-extra id) - (gnosis-review--update id (if success 1 0)) + (gnosis-review--update id success) (gnosis-display-next-review id))) (defun gnosis-review-cloze--input (cloze) @@ -995,10 +996,10 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face." ;; clozes. (when (< num clozes-num) (gnosis-review-cloze-reveal-unaswered clozes)) (gnosis-display-cloze-user-answer (cdr input)) - (gnosis-review--update id 0) + (gnosis-review--update id nil) (cl-return))) ;; Update note after all clozes are revealed successfully - finally (gnosis-review--update id 1))) + finally (gnosis-review--update id t))) (gnosis-display-extra id) (gnosis-display-next-review id)) |