summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-11-29 08:01:24 +0200
committerThanos Apollo <[email protected]>2023-11-29 08:01:24 +0200
commit91db2020882358c7c5d43c2ce3719e6d00998de3 (patch)
treed106c3b0f22ed4e82513f5f2aa93de058fbe4208 /gnosis.el
parent692c30c29cb76c8f71ab4d226fc7d901996b0eb9 (diff)
Remove duplicate `get` functions, redo as gnosis--get
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el18
1 files 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)))