summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-03 02:27:07 +0200
committerThanos Apollo <[email protected]>2024-03-03 02:27:35 +0200
commitcb391c6e86a17270ccb9735b8b1b91a7d0669c70 (patch)
treecbe09a58f50bcb4b7398dd9b16995ead035a304e /gnosis.el
parent70aac53df16e3cf4321f68ebe8e1fcded4abf4c3 (diff)
Add gnosis-dashboard-deck-note-count
Return total deck note count in a list. Will be used to output decks.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index d973d64..1832b7e 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1544,6 +1544,11 @@ name and all notes formatted as nested lists"
(gnosis-dashboard-output-notes)
(revert-buffer t t t)))))
+(defun gnosis-dashboard-deck-note-count (id)
+ "Return total note count for deck with ID."
+ (let ((note-count (caar (emacsql gnosis-db (format "SELECT COUNT(*) FROM notes WHERE deck_id=%s" id)))))
+ (when (gnosis-select 'id 'decks `(= id ,id))
+ (list (number-to-string note-count)))))
(defun gnosis-dashboard-edit-note ()
"Get note id from tabulated list and edit it."
(interactive)