branch: elpa/gnosis
commit 95a4aeebe64c348d4ad94b8ce9251e5f41fb3401
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>
[New] get-themata-by-reviews: Return thema ids for max-reviews.
---
gnosis.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gnosis.el b/gnosis.el
index 68c5d6e392..782151fb7d 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1261,6 +1261,16 @@ Returns a cons; ='(position . user-input) if correct,
(let ((reviews (car (gnosis-select 'n 'review-log `(= id ,id) t))))
(not (> reviews 0))))
+(defun gnosis-get-themata-by-reviews (max-reviews &optional thema-ids)
+ "Return thema IDs with at most MAX-REVIEWS total reviews.
+When THEMA-IDS is non-nil, restrict to that subset."
+ (gnosis-select 'id 'review-log
+ (if thema-ids
+ `(and (<= n ,max-reviews)
+ (in id ,(vconcat thema-ids)))
+ `(<= n ,max-reviews))
+ t))
+
(defun gnosis-review-increment-activity-log (new? &optional date)
"Increment activity log for DATE by one.