From 112693dd653ea6ea8bbdf05506ac8aacc4f5e3df Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 10 Dec 2024 16:32:57 +0200 Subject: Version bump: 0.4.9 - Create dashboard async - Minor bug fixes --- gnosis.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnosis.el b/gnosis.el index c740c59..9a83e02 100644 --- a/gnosis.el +++ b/gnosis.el @@ -5,7 +5,7 @@ ;; Author: Thanos Apollo ;; Keywords: extensions ;; URL: https://thanosapollo.org/projects/gnosis -;; Version: 0.4.8 +;; Version: 0.4.9 ;; Package-Requires: ((emacs "27.2") (emacsql "4.0.1") (compat "29.1.4.2") (transient "0.7.2")) -- cgit v1.2.3 From 3265f6486eba09bf00850627a231cb26731009c6 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 10 Dec 2024 22:37:15 +0200 Subject: dashboard: Improve performance by 97% * Add gnosis-dashboard--output-notes. * Adjust emacsql queries to improve performance, depend less on emacs-lisp loops. --- gnosis.el | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/gnosis.el b/gnosis.el index 9a83e02..c094194 100644 --- a/gnosis.el +++ b/gnosis.el @@ -2678,20 +2678,10 @@ Skips days where no note was reviewed." (if (null reviews) 0 (format "%.2f" (/ (apply '+ reviews) (float (length reviews))))))) -(defun gnosis-dashboard-output-note (id) - "Output contents for note with ID, formatted for gnosis dashboard." - (cl-loop for item in (append (gnosis-select - '[main options answer tags type] 'notes `(= id ,id) t) - (gnosis-select 'suspend 'review-log `(= id ,id) t)) - if (listp item) - collect (mapconcat #'identity item ",") - else - collect (replace-regexp-in-string "\n" " " (format "%s" item)))) - -(defun gnosis-dashboard-edit-note (&optional id) +(defun gnosis-dashboard-edit-note () "Edit note with ID." (interactive) - (let ((id (or id (string-to-number (tabulated-list-get-id))))) + (let ((id (tabulated-list-get-id))) (gnosis-edit-note id))) (defun gnosis-dashboard-suspend-note () @@ -2734,6 +2724,26 @@ Skips days where no note was reviewed." "Minor mode for gnosis dashboard notes output." :keymap gnosis-dashboard-notes-mode-map) +(defun gnosis-dashboard--output-notes (note-ids) + "Output tabulated-list format for NOTE-IDS." + (cl-assert (listp note-ids)) + (let ((entries (emacsql gnosis-db + `[:select + [notes:id notes:main notes:options notes:answer + notes:tags notes:type review-log:suspend] + :from notes + :join review-log :on (= notes:id review-log:id) + :where (in notes:id ,(vconcat note-ids))]))) + (cl-loop for sublist in entries + collect + (list (car sublist) + (vconcat + (cl-loop for item in (cdr sublist) + if (listp item) + collect (mapconcat #'identity item ",") + else + collect (replace-regexp-in-string "\n" " " (format "%s" item)))))))) + (defun gnosis-dashboard-output-notes (note-ids) "Return NOTE-IDS contents on gnosis dashboard." (cl-assert (listp note-ids) t "`note-ids' must be a list of note ids.") @@ -2752,14 +2762,10 @@ Skips days where no note was reviewed." (tabulated-list-init-header) (let ((inhibit-read-only t)) (erase-buffer) - (insert "Loading notes...")) + (insert (format "Loading %s notes..." (length note-ids)))) (run-with-timer 0.1 nil (lambda () - (let ((entries - (cl-loop for id in note-ids - for output = (gnosis-dashboard-output-note id) - when output - collect (list (number-to-string id) (vconcat output))))) + (let ((entries (gnosis-dashboard--output-notes note-ids))) (with-current-buffer gnosis-dashboard-buffer-name (setq tabulated-list-entries entries) (tabulated-list-print t) -- cgit v1.2.3 From 42b3f00f88bc6dc8c8b207be7548f29a7777b136 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 10 Dec 2024 22:38:33 +0200 Subject: Version bump: 0.4.10 * Implement major performance improvements in gnosis-dashboard. --- gnosis.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnosis.el b/gnosis.el index c094194..2b5313d 100644 --- a/gnosis.el +++ b/gnosis.el @@ -5,7 +5,7 @@ ;; Author: Thanos Apollo ;; Keywords: extensions ;; URL: https://thanosapollo.org/projects/gnosis -;; Version: 0.4.9 +;; Version: 0.4.10 ;; Package-Requires: ((emacs "27.2") (emacsql "4.0.1") (compat "29.1.4.2") (transient "0.7.2")) -- cgit v1.2.3 From 943d9217a40cd6d1b0dd9b4e459b262234d57075 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 10 Dec 2024 22:40:06 +0200 Subject: Update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 643722b..593bacd 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,11 @@ -*- mode: org -*- +* 0.4.10 ++ Implement major performance improvements in gnosis-dashboard. + +* 0.4.9 +- Implement asynchronous dashboard creation +- Minor bug fixes + * 0.4.8 + Refactor average review output -- cgit v1.2.3