[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gnosis 21d5498e8d 3/8: Refactor review-get-due-notes
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gnosis 21d5498e8d 3/8: Refactor review-get-due-notes |
Date: |
Thu, 7 Nov 2024 04:00:32 -0500 (EST) |
branch: elpa/gnosis
commit 21d5498e8d0c53b7cc5d5bb813f830d92223b44c
Author: Thanos Apollo <public@thanosapollo.org>
Commit: Thanos Apollo <public@thanosapollo.org>
Refactor review-get-due-notes
* Create #'gnosis-review-get--due-notes that returns due note ids and
due dates
* Create #'gnosis-review-get-due-notes that uses the above functions
output but only returns due ids
* This is done to improve perfomance & to reduce sql query calls
---
gnosis.el | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/gnosis.el b/gnosis.el
index 610611451b..61f58fe497 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1469,22 +1469,30 @@ well."
(let ((next-rev (gnosis-get 'next-rev 'review-log `(= id ,id))))
(gnosis-past-or-present-p next-rev)))
-(defun gnosis-review-get-due-notes ()
- "Return a list due notes id for current date."
- (let* ((old-notes (cl-loop for note in (gnosis-select 'id 'review-log '(and
(> n 0)
-
(= suspend 0))
- t)
- when (gnosis-review-is-due-p note)
+(defun gnosis-review-get--due-notes ()
+ "Return due note IDs & due dates."
+ (let* ((old-notes (cl-loop for note in
+ (gnosis-select '[id next-rev] 'review-log
+ '(and (> n 0)
+ (= suspend 0))
+ nil)
+ when (gnosis-past-or-present-p (cadr note))
collect note))
- (new-notes (cl-loop for note in (gnosis-select 'id 'review-log '(and
(= n 0)
-
(= suspend 0))
- t)
- when (gnosis-review-is-due-today-p note)
+ (new-notes (cl-loop for note in
+ (gnosis-select '[id next-rev] 'review-log
+ '(and (= n 0)
+ (= suspend 0))
+ nil)
+ when (gnosis-past-or-present-p (cadr note))
collect note)))
(if gnosis-review-new-first
(append (cl-subseq new-notes 0 gnosis-new-notes-limit) old-notes)
(append old-notes (cl-subseq new-notes 0 gnosis-new-notes-limit)))))
+(defun gnosis-review-get-due-notes ()
+ "Return all due note IDs."
+ (mapcar #'car (gnosis-review-get--due-notes)))
+
(defun gnosis-review-get-overdue-notes (&optional note-ids)
"Return overdue notes for current DATE.
- [nongnu] elpa/gnosis updated (ce54993dc3 -> 5ab8ef8ca7), ELPA Syncer, 2024/11/07
- [nongnu] elpa/gnosis 596ab975d6 2/8: Remove gnosis-review-note-overdue-p, ELPA Syncer, 2024/11/07
- [nongnu] elpa/gnosis 6fad435b9a 6/8: gnosis-face-cloze: Use highlight instead of ffap., ELPA Syncer, 2024/11/07
- [nongnu] elpa/gnosis a8bd341f3d 5/8: Optimize dashboard homepage performance, ELPA Syncer, 2024/11/07
- [nongnu] elpa/gnosis c77f6787d1 4/8: Fix indentation, ELPA Syncer, 2024/11/07
- [nongnu] elpa/gnosis 7f6dd4e2b0 1/8: validate-custom-values: Update error messages., ELPA Syncer, 2024/11/07
- [nongnu] elpa/gnosis 21d5498e8d 3/8: Refactor review-get-due-notes,
ELPA Syncer <=
- [nongnu] elpa/gnosis 5ab8ef8ca7 8/8: Update gitignore, ELPA Syncer, 2024/11/07
- [nongnu] elpa/gnosis bfce6f9467 7/8: Version bump: 0.4.7, ELPA Syncer, 2024/11/07