summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-13 15:27:53 +0200
committerThanos Apollo <[email protected]>2023-12-13 15:28:33 +0200
commitb71e2ea92fca02e02e3304a68a6d3571d621f76a (patch)
tree64df241521f3ba67cc143b19b64df692275325d1 /gnosis.el
parentd92c46395529b7016daf8f2b1a68a7bcd9ec3ec4 (diff)
mcq: Use gnosis--select
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/gnosis.el b/gnosis.el
index 017c2e0..dafbc6d 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -73,7 +73,7 @@
(defun gnosis--display-question (id)
"Display main row for question ID."
- (let ((question (gnosis--get-id 'notes 'main id)))
+ (let ((question (caar (gnosis--select 'main 'notes `(= id ,id)))))
;; Animate.el is used only for testing purposes.
(animate-string question 5)))
@@ -139,14 +139,14 @@ TAGS are used to organize questions."
(defun gnosis-mcq-answer (id)
"Choose the correct answer, from mcq choices for question ID."
- (let ((choices (gnosis--get-id 'notes 'options id))
+ (let ((choices (gnosis--select 'options 'notes `(= id ,id)))
(history-add-new-input nil)) ;; Disable history
(completing-read "Answer: " choices)))
(defun gnosis-review-mcq-choices (id)
"Display multiple choice answers for question ID."
- (let ((canswer (gnosis--get-id 'notes 'answer id))
- (choices (gnosis--get-id 'notes 'options id))
+ (let ((canswer (gnosis--select 'answer 'notes `(= id ,id)))
+ (choices (gnosis--select 'answer 'notes `(= id ,id)))
(user-choice (gnosis-mcq-answer id)))
(if (equal (nth (- canswer 1) choices) user-choice)
(message "Correct!")