Skip to content

Commit

Permalink
create new fuzz range for apply easy day
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Apr 26, 2024
1 parent 35d7c1f commit 2350fb0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions schedule/easy_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def easy_days(did):
recent=False,
filter_flag=True,
filtered_cids=set(due_in_easy_days_cids),
apply_easy_days=True,
)
if fut:
return fut.result()
Expand Down Expand Up @@ -158,6 +159,7 @@ def apply_easy_day_for_specific_date(self):
filter_flag=True,
filtered_cids=set(filtered_dues_cids),
easy_specific_due_dates=specific_dues,
apply_easy_days=True,
)


Expand Down
26 changes: 22 additions & 4 deletions schedule/reschedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class FSRS:
card: Card
elapsed_days: int
allow_to_past: bool
apply_easy_days: bool

def __init__(self) -> None:
self.maximum_interval = 36500
Expand All @@ -35,6 +36,7 @@ def __init__(self) -> None:
self.p_obey_specific_due_dates = 1
self.elapsed_days = 0
self.allow_to_past = True
self.apply_easy_days = False

def set_load_balance(self):
self.enable_load_balance = True
Expand Down Expand Up @@ -81,7 +83,7 @@ def apply_fuzz(self, ivl):
else:
return int(self.fuzz_factor * (max_ivl - min_ivl + 1) + min_ivl)
else:
if not self.allow_to_past:
if self.apply_easy_days:
last_review = get_last_review_date(self.card)
due = self.card.odue if self.card.odid else self.card.due
if due > last_review + max_ivl + 2:
Expand Down Expand Up @@ -141,7 +143,12 @@ def set_card(self, card: Card):


def reschedule(
did, recent=False, filter_flag=False, filtered_cids={}, easy_specific_due_dates=[]
did,
recent=False,
filter_flag=False,
filtered_cids={},
easy_specific_due_dates=[],
apply_easy_days=False,
):
if not mw.col.get_config("fsrs"):
tooltip(FSRS_ENABLE_WARNING)
Expand All @@ -165,7 +172,12 @@ def on_done(future):

fut = mw.taskman.run_in_background(
lambda: reschedule_background(
did, recent, filter_flag, filtered_cids, easy_specific_due_dates
did,
recent,
filter_flag,
filtered_cids,
easy_specific_due_dates,
apply_easy_days,
),
on_done,
)
Expand All @@ -174,7 +186,12 @@ def on_done(future):


def reschedule_background(
did, recent=False, filter_flag=False, filtered_cids={}, easy_specific_due_dates=[]
did,
recent=False,
filter_flag=False,
filtered_cids={},
easy_specific_due_dates=[],
apply_easy_days=False,
):
config = Config()
config.load()
Expand All @@ -193,6 +210,7 @@ def reschedule_background(
)
if len(easy_specific_due_dates) > 0:
fsrs.allow_to_past = False
fsrs.apply_easy_days = apply_easy_days
DM = DeckManager(mw.col)
if did is not None:
did_list = ids2str(DM.deck_and_child_ids(did))
Expand Down

0 comments on commit 2350fb0

Please sign in to comment.