summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-16 09:47:55 +0300
committerThanos Apollo <[email protected]>2024-07-16 09:47:55 +0300
commit9a68868346bc4e3a385480140f60e7736ed7c364 (patch)
tree957a55c0f66b9cc6daaeb0f4ccab6bb7345092c9 /gnosis.el
parent7230e3f8c720d986b97c8e090cd34019947b4426 (diff)
[fix] cloze: Update assertiong when editing cloze notes.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index cbc053b..768a05f 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1874,6 +1874,10 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend"
(cl-assert (and (listp ef) (length= ef 3)) nil "ef 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 (string= (gnosis-get-type id) "cloze")
+ (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)."))
;; Construct the update clause for the emacsql update statement.
(cl-loop for (field . value) in `((main . ,main)
(options . ,options)