summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-26 03:04:59 +0200
committerThanos Apollo <[email protected]>2023-12-26 03:04:59 +0200
commit1075592142d973873d2c953b4b90af02c2814281 (patch)
treea61e957aedd242eb28a3d5070f4f18405b4468aa /gnosis.el
parent00daa6e96c4b38dfae1c278ee584978aa6d23c2c (diff)
[fix] Return suspend as integer value, fix dosctrings and minor bugs
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 3bb4ef8..35d8432 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -167,7 +167,7 @@ Set SPLIT to t to split all input given."
(gnosis--delete 'decks `(= name ,deck))
(message "Deleted deck %s" deck))
-(cl-defun gnosis-add-note-mcq (&key deck question choices correct-answer extra (image nil) tags (suspend nil))
+(cl-defun gnosis-add-note-mcq (&key deck question choices correct-answer extra (image nil) tags (suspend 0))
"Create a NOTE with a list of multiple CHOICES.
MCQ type consists of a main `QUESTION' that is displayed to the user.
@@ -228,7 +228,7 @@ Returns a list of the form ((yyyy mm dd) ef)."
"Get due notes id for current date.
Select notes where:
- - Next review schedulated date <= current date
+ - Next review date <= current date
- Not suspended."
(emacsql gnosis-db [:select [id] :from review-log :where (and (<= next-rev ',(gnosis-algorithm-date))
(not suspend))]))
@@ -270,7 +270,7 @@ Returns a list of the form (ef-increase ef-decrease ef)."
(let ((answer (gnosis-get 'answer 'notes `(= id ,id)))
(choices (gnosis-get 'options 'notes `(= id ,id)))
(user-choice (gnosis-mcq-answer id)))
- (if (equal (nth (- answer 1) choices) user-choice)
+ (if (equal (nth answer choices) user-choice)
(progn (gnosis-review--success id)
(message "Correct!"))
(message "False"))
@@ -335,7 +335,7 @@ Returns a list of the form (ef-increase ef-decrease ef)."
(last-rev integer :not-null) ;; Last review date
(next-rev integer :not-null) ;; Next review date
(failures integer :not-null) ;; Number of consecutive review failures
- (suspend integer)
+ (suspend integer :not-null) ;; Binary value, 1=suspended
(n integer :not-null)] ;; Number of reviews
(:foreign-key [id] :references notes [id]
:on-delete :cascade)))