From cb391c6e86a17270ccb9735b8b1b91a7d0669c70 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 3 Mar 2024 02:27:07 +0200 Subject: Add gnosis-dashboard-deck-note-count Return total deck note count in a list. Will be used to output decks. --- gnosis.el | 5 +++++ 1 file changed, 5 insertions(+) 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) -- cgit v1.2.3