summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-23 14:06:47 +0200
committerThanos Apollo <[email protected]>2023-12-23 14:06:47 +0200
commitf2da68563a89b76c7e3613dbc2d67e288a864bb6 (patch)
tree8ee3066b718f10f879e8de60f80784a6c17e913c /gnosis.el
parent3af9ba3c4b56327bbacc1b2812dbf1cf794a7cfc (diff)
Add gnosis-review-new-f
Calculate new ef for card id, based on SUCCESS. To make tracking easier, easiness factor is a list consisting of (ef-increase ef-decrease ef), where ef-increase & ef-decrease are used to calculate new ef upon review.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index ddfeae9..a25a673 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -188,6 +188,14 @@ This function is used to round floating point numbers to 1 decimal,
such as the easiness factor (ef)."
(/ (round (* num 100.00)) 100.00))
+(defun gnosis-review-new-ef (id success)
+ "Get 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)."
+ (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)))
(defun gnosis-review--success (id)
"Update review-log for note with value of id ID."