diff --git a/config.json b/config.json index dd183ef..7522798 100644 --- a/config.json +++ b/config.json @@ -13,5 +13,6 @@ "fsrs_stats": true, "display_memory_state": false, "auto_easy_days": false, - "has_rated": false + "has_rated": false, + "reschedule_threshold": 0.3 } \ No newline at end of file diff --git a/configuration.py b/configuration.py index 9b8c1dc..06f584b 100644 --- a/configuration.py +++ b/configuration.py @@ -17,6 +17,7 @@ DISPLAY_MEMORY_STATE = "display_memory_state" AUTO_EASY_DAYS = "auto_easy_days" HAS_RATED = "has_rated" +RESCHEDULE_THRESHOLD = "reschedule_threshold" def load_config(): @@ -177,3 +178,12 @@ def has_rated(self): def has_rated(self, value): self.data[HAS_RATED] = value self.save() + + @property + def reschedule_threshold(self): + return self.data[RESCHEDULE_THRESHOLD] + + @reschedule_threshold.setter + def reschedule_threshold(self, value): + self.data[RESCHEDULE_THRESHOLD] = value + self.save() \ No newline at end of file diff --git a/schedule/reschedule.py b/schedule/reschedule.py index 8e6162c..1eba98a 100644 --- a/schedule/reschedule.py +++ b/schedule/reschedule.py @@ -25,6 +25,7 @@ class FSRS: elapsed_days: int allow_to_past: bool apply_easy_days: bool + reschedule_threshold: float def __init__(self) -> None: self.maximum_interval = 36500 @@ -38,6 +39,9 @@ def __init__(self) -> None: self.elapsed_days = 0 self.allow_to_past = True self.apply_easy_days = False + config = Config() + config.load() + self.reschedule_threshold = config.reschedule_threshold def set_load_balance(self, did_query=None): self.enable_load_balance = True @@ -332,6 +336,8 @@ def reschedule_card(cid, fsrs: FSRS, recompute=False): fsrs.set_card(card) fsrs.set_fuzz_factor(cid, card.reps) new_ivl = fsrs.next_interval(s) + if (new_ivl - card.ivl) / card.ivl < fsrs.reschedule_threshold: + return None due_before = max(card.odue if card.odid else card.due, mw.col.sched.today) card = update_card_due_ivl(card, new_ivl) due_after = max(card.odue if card.odid else card.due, mw.col.sched.today)