diff options
author | Thanos Apollo <[email protected]> | 2023-12-23 14:05:35 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-12-23 14:05:35 +0200 |
commit | 3af9ba3c4b56327bbacc1b2812dbf1cf794a7cfc (patch) | |
tree | a89dbad021b6fe205723072de6b44d66c1d9f51d | |
parent | be6755a94a24d5685ffa0a87a89c8df4416bdaca (diff) |
Add gnosis-review-round
Function to round arg to 1 decimal. Used for calculating new easiness
factor (ef/new-ef)
-rw-r--r-- | gnosis.el | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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." |