From 91db2020882358c7c5d43c2ce3719e6d00998de3 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 29 Nov 2023 08:01:24 +0200 Subject: Remove duplicate `get` functions, redo as gnosis--get --- gnosis.el | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/gnosis.el b/gnosis.el index 7757e07..a57ab2f 100644 --- a/gnosis.el +++ b/gnosis.el @@ -54,21 +54,13 @@ "Insert VALUES to TABLE-NAME." (emacsql gnosis-db `[:insert :into ,table-name :values ,values])) -(defun gnosis--get-question (id) - "Get question row for question ID." - (caar (gnosis--select 'notes 'question `(= question_id ,id)))) - -(defun gnosis--get-correct-answer (id) - "Get correct answer for question ID." - (caar (gnosis--select 'notes 'answer `(= question_id ,id)))) - -(defun gnosis--get-mcanswers (id) - "Get multiple choices for question ID." - (caar (gnosis--select 'notes 'choices `(= question_id ,id)))) +(defun gnosis--get (table value id) + "Get VALUE for question ID from TABLE." + (caar (gnosis--select table value `(= id ,id)))) (defun gnosis--display-question (id) - "Display question for question ID." - (let ((question (gnosis--get-question id))) + "Display main row for question ID." + (let ((question (gnosis--get 'notes 'main id))) ;; Animate.el is used only for testing purposes. (animate-string question 5))) -- cgit v1.2.3