From e51d9268dd5fb0c11eec8a7369ff7be2bf4b5a6c Mon Sep 17 00:00:00 2001 From: Jarrett Ye Date: Wed, 12 Jun 2024 14:34:37 +0800 Subject: [PATCH] Fix/reschedule in n days affects manually rescheduled cards --- schedule/reschedule.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/schedule/reschedule.py b/schedule/reschedule.py index 8e6162c..e498db4 100644 --- a/schedule/reschedule.py +++ b/schedule/reschedule.py @@ -66,6 +66,7 @@ def set_load_balance(self, did_query=None): f"""SELECT (id/1000-{mw.col.sched.day_cutoff})/86400, count(distinct cid) FROM revlog WHERE ease > 0 + AND (type < 3 OR factor != 0) GROUP BY (id/1000-{mw.col.sched.day_cutoff})/86400""" ) } @@ -233,7 +234,15 @@ def reschedule_background( today_cutoff = mw.col.sched.day_cutoff day_before_cutoff = today_cutoff - (config.days_to_reschedule + 1) * 86400 recent_query = ( - f"AND id IN (SELECT cid FROM revlog WHERE id >= {day_before_cutoff * 1000})" + f"""AND id IN + ( + SELECT cid + FROM revlog + WHERE id >= {day_before_cutoff * 1000} + AND ease > 0 + AND (type < 3 OR factor != 0) + ) + """ ) if filter_flag: