summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-11-27 21:07:28 +0200
committerThanos Apollo <[email protected]>2023-11-27 21:07:28 +0200
commit9c147582ee4e4ec7880e259613e4058271c09cdc (patch)
tree2c7beee3c7fb5d7eaf7d6032cd3dff7011260a6e
parent0fb673f57fb8d0b051406c486f1f2d03c4a0fc97 (diff)
Add qbank-create-question
- Add function to create question as TYPE. - Remove duplicate functions & add footer.
-rw-r--r--qbank.el20
1 files changed, 11 insertions, 9 deletions
diff --git a/qbank.el b/qbank.el
index a61b9c7..0778503 100644
--- a/qbank.el
+++ b/qbank.el
@@ -83,15 +83,6 @@
(pop mcqs))
(reverse mcqs)))
-
-(defun qbank-create-mcq-question ()
- "Create question as MCQ type."
- (interactive)
- (let ((question (read-string "Question: "))
- (choices (unless (equal choices "q")
- (read-string "Choices: ")))))
- (qbank--insert-into '))
-
(cl-defun qbank-create-mcq-question (&key question choices correct-answer)
"Create a QUESTION with a list of multiple CHOICES and one CORRECT-ANSWER.
@@ -107,6 +98,15 @@ use it like this:
:correct-answer (string-to-number (read-string "Which is the correct answer?"))))
(qbank--insert-into 'qbank1 `([nil ,question ,choices ,correct-answer])))
+(defun qbank-create-question (type)
+ "Create question as TYPE."
+ (interactive (list (completing-read "Type: " '(MCQ Cloze Basic))))
+ (pcase type
+ ("MCQ" (call-interactively 'qbank-create-mcq-question))
+ ("Cloze" (message "Not ready yet."))
+ ("Basic" (message "Not ready yet."))
+ (_ (message "No such type."))))
+
;; Fix: review for seperate question types.
(defun qbank-review (id)
"Start review for question ID."
@@ -124,3 +124,5 @@ use it like this:
(switch-to-buffer (get-buffer-create "*qbank*"))
(qbank--display-question 13)
(qbank-review 13)))
+
+;;; qbank.el ends here