summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-23 14:05:35 +0200
committerThanos Apollo <[email protected]>2023-12-23 14:05:35 +0200
commit3af9ba3c4b56327bbacc1b2812dbf1cf794a7cfc (patch)
treea89dbad021b6fe205723072de6b44d66c1d9f51d /gnosis.el
parentbe6755a94a24d5685ffa0a87a89c8df4416bdaca (diff)
Add gnosis-review-round
Function to round arg to 1 decimal. Used for calculating new easiness factor (ef/new-ef)
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/gnosis.el b/gnosis.el
index e6ceb36..ddfeae9 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -181,15 +181,13 @@ Returns a list of the form ((yyyy mm dd) ef)."
(let ((last-rev (gnosis-get 'last-rev 'review-log `(= id ,id))))
(gnosis-algorithm-date-diff last-rev)))
-(defun gnosis-review--new-ef (id success)
- "Update ef for note with value of id ID.
-
-SUCCESS is a binary value, 1 = success, 0 = failure."
- (cl-assert (or (equal success 1) (equal success 0)))
- (let ((ef (gnosis-review--algorithm id success)))
- (if (equal success 1)
- (nth 0 ef)
- (nth 1 ef))))
+(defun gnosis-review-round (num)
+ "Round NUM to 1 decimal.
+
+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--success (id)
"Update review-log for note with value of id ID."