From ac99bcc1583147f9e6ee8e071efb8071bc515d0d Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 29 Nov 2023 08:03:52 +0200 Subject: Update review functionallity - Use gnosis-review pcase statement to call different review processes depending on note/question type. - Update gnosis mcq type review process --- gnosis.el | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index a57ab2f..84e33bb 100644 --- a/gnosis.el +++ b/gnosis.el @@ -108,16 +108,29 @@ use it like this: ("Basic" (message "Not ready yet.")) (_ (message "No such type.")))) -;; Fix: review for seperate question types. -(defun gnosis-review (id) - "Start review for question ID." - (let ((canswer (gnosis--get-correct-answer id)) - (choices (gnosis--get-mcanswers id)) - (user-choice (gnosis--mcanswers-choice id))) +(defun gnosis-mcq-answer (id) + "Choose the correct answer, from mcq choices for question ID." + (let ((choices (gnosis--get 'notes 'options 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 'notes 'answer id)) + (choices (gnosis--get 'notes 'options id)) + (user-choice (gnosis-mcq-answer id))) (if (equal (nth (- canswer 1) choices) user-choice) (message "Correct!") (message "False")))) +(defun gnosis-review (id) + "Start review for question ID." + (let ((type (gnosis--get 'notes 'type id))) + (pcase type + ("mcq" (gnosis-review-mcq-choices id)) + ("basic" (message "Not Ready yet.")) + ("cloze" (message "Not Ready yet."))))) + ;; testing (defun gnosis-test-buffer () "Create testing buffer." -- cgit v1.2.3