Skip to content

Commit

Permalink
reschedule cards only if ivl is different by >x%
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jun 2, 2024
1 parent 68dfe72 commit 2dc880c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
10 changes: 10 additions & 0 deletions configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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()
6 changes: 6 additions & 0 deletions schedule/reschedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2dc880c

Please sign in to comment.