summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-06 23:50:14 +0300
committerThanos Apollo <[email protected]>2024-08-06 23:50:14 +0300
commit53cb07663067ab28c8b210cd008b74de3ae01d94 (patch)
tree0873c316a4d7a9ae63d0e85b6047015cd892231c /gnosis.el
parent085a3aef8014fbd0a244380bcc12ba17546b8228 (diff)
edit-update-note: Update to new db variables.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/gnosis.el b/gnosis.el
index 8c0762d..a39d08b 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1922,8 +1922,8 @@ DESCRIPTION is a string that describes the value."
:lighter " Gnosis Edit"
:keymap gnosis-edit-mode-map)
-(cl-defun gnosis-edit-update-note (&key id main options answer tags (extra-notes nil) (image nil) (second-image nil)
- ef ff suspend)
+(cl-defun gnosis-edit-update-note (&key id main options answer tags (extra-notes nil) (image nil)
+ (second-image nil) gnosis amnesia suspend)
"Update note with id value of ID.
ID: Note id
@@ -1934,8 +1934,8 @@ TAGS: Tags for note, used to organize & differentiate between notes
EXTRA-NOTES: Notes to display after user-input
IMAGE: Image to display before user-input
SECOND-IMAGE: Image to display after user-input
-EF: Easiness factor value
-FF: Failure factor value
+GNOSIS: Gnosis score
+AMNESIA: Amnesia value
SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend"
(cl-assert (stringp main) nil "Main must be a string")
(cl-assert (or (stringp image) (null image)) nil
@@ -1945,14 +1945,15 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend"
(cl-assert (or (stringp extra-notes) (null extra-notes)) nil
"Extra-notes must be a string, or nil")
(cl-assert (listp tags) nil "Tags must be a list of strings")
- (cl-assert (and (listp ef) (length= ef 3)) nil "ef must be a list of 3 floats")
+ (cl-assert (and (listp gnosis) (length= gnosis 3)) nil "gnosis must be a list of 3 floats")
(cl-assert (or (stringp options) (listp options)) nil "Options must be a string, or a list for MCQ")
(cl-assert (or (= suspend 0) (= suspend 1)) nil "Suspend must be either 0 or 1")
(when (and (string= (gnosis-get-type id) "cloze")
(not (stringp options)))
(cl-assert (or (listp options) (stringp options)) nil "Options must be a list or a string.")
(cl-assert (gnosis-cloze-check main answer) nil "Clozes are not part of the question (main).")
- (cl-assert (>= (length answer) (length options)) nil "Hints (options) must be equal or less than clozes (answer).")
+ (cl-assert (>= (length answer) (length options)) nil
+ "Hints (options) must be equal or less than clozes (answer).")
(cl-assert (cl-every (lambda (item) (or (null item) (stringp item))) options) nil "Hints (options) must be either nil or a string."))
;; Construct the update clause for the emacsql update statement.
(cl-loop for (field . value) in `((main . ,main)
@@ -1962,13 +1963,13 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend"
(extra-notes . ,extra-notes)
(images . ,image)
(extra-image . ,second-image)
- (ef . ',ef)
- (ff . ,ff)
+ (gnosis . ',gnosis)
+ (amnesia . ,amnesia)
(suspend . ,suspend))
when value
do (cond ((memq field '(extra-notes images extra-image))
(gnosis-update 'extras `(= ,field ,value) `(= id ,id)))
- ((memq field '(ef ff))
+ ((memq field '(gnosis amnesia))
(gnosis-update 'review `(= ,field ,value) `(= id ,id)))
((eq field 'suspend)
(gnosis-update 'review-log `(= ,field ,value) `(= id ,id)))