summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-17 08:24:02 +0300
committerThanos Apollo <[email protected]>2024-07-17 08:24:37 +0300
commita7c85363850b96176f502eecdc2a9d7b046c355c (patch)
treef485cc22442199a3456a770cf36cf57ee5ef81db
parentbd1844395752dce33587dfb6d9b76586217e3035 (diff)
[fix] cloze: Update assertions when editing notes
* Adjust for when cloze hints are just a single string. This is common in cloze notes that were made using the old format.
-rw-r--r--gnosis.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnosis.el b/gnosis.el
index cfd2f2d..d9c657f 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1889,7 +1889,8 @@ 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")
+ (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)."))