summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-03 02:27:49 +0200
committerThanos Apollo <[email protected]>2024-03-03 02:27:49 +0200
commitcbf93bf3b216dc356184d59c05d07b8e6c76aa21 (patch)
tree86dc49170d4daeaa70319630b74db2ed52bb40c0 /gnosis.el
parentcb391c6e86a17270ccb9735b8b1b91a7d0669c70 (diff)
Add gnosis-dashboard-output-deck
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 1832b7e..d3df6c1 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1549,6 +1549,16 @@ name and all notes formatted as nested lists"
(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-output-deck (id)
+ "Output deck contents formatted for gnosis dashboard."
+ (cl-loop for item in (append (gnosis-select '[name failure-factor ef-increase ef-decrease ef-threshold]
+ 'decks `(= id ,id) t)
+ (gnosis-dashboard-deck-note-count id))
+ when (listp item)
+ do (cl-remove-if (lambda (x) (and (vectorp x) (zerop (length x)))) item)
+ collect (prin1-to-string item)))
+
(defun gnosis-dashboard-edit-note ()
"Get note id from tabulated list and edit it."
(interactive)