summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-20 06:51:48 +0300
committerThanos Apollo <[email protected]>2024-07-20 06:51:48 +0300
commitd34c22f1781676018d575e6274e7975c2d986e94 (patch)
tree1ebc1b837ee834f33f65183d7c165fa7f1905ed1 /gnosis.el
parent6d305eb08092d155d3e00a61122732586e3030a6 (diff)
[Refactor] gnosis-review-get-due-notes: Adjust for new notes limit.
* Use gnosis-new-notes-limit to calculate new notes for review.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/gnosis.el b/gnosis.el
index dfbf265..e3577bc 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1375,10 +1375,14 @@ well."
(defun gnosis-review-get-due-notes ()
"Return a list due notes id for current date."
- (let ((notes (gnosis-select 'id 'notes '1=1 t)))
- (cl-loop for note in notes
- when (gnosis-review-is-due-p note)
- collect note)))
+ (let* ((old-notes (cl-loop for note in (gnosis-select 'id 'review-log '(> n 0) t)
+ when (gnosis-review-is-due-p note)
+ collect note))
+ (new-notes (cl-loop for note in (gnosis-select 'id 'review-log '(= n 0) t)
+ when (gnosis-review-is-due-p note)
+ collect note)))
+ (append (cl-subseq new-notes 0 gnosis-new-notes-limit) old-notes)))
+
(defun gnosis-get-new-notes (notes)
"Get new notes from NOTES."
(cl-assert (listp notes) nil "Notes must be a list.")