Skip to content

Commit

Permalink
speed up easy days
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Nov 30, 2024
1 parent 1210481 commit 2be54cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions schedule/reschedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class FSRS:
today: int
did: int
did_to_preset_id: Dict[int, int]
preset_id_to_easy_days_percentages: Dict[int, List[float]]

def __init__(self) -> None:
self.reschedule_threshold = 0
Expand All @@ -58,11 +59,13 @@ def set_load_balance(self, did_query=None):

self.due_cnt_per_day_per_preset = defaultdict(lambda: defaultdict(int))
self.did_to_preset_id = {}
self.preset_id_to_easy_days_percentages = {}

for did, due_date, count in deck_stats:
preset_id = self.DM.config_dict_for_deck_id(did)["id"]
self.due_cnt_per_day_per_preset[preset_id][due_date] += count
self.did_to_preset_id[did] = preset_id
self.preset_id_to_easy_days_percentages[preset_id] = self.DM.config_dict_for_deck_id(did)["easyDaysPercentages"]

self.due_today_per_preset = defaultdict(
int,
Expand Down Expand Up @@ -121,9 +124,7 @@ def reviewed_today(self):

@property
def easy_days_review_ratio_list(self):
easy_days_percentages = self.DM.config_dict_for_deck_id(self.did)[
"easyDaysPercentages"
]
easy_days_percentages = self.preset_id_to_easy_days_percentages[self.preset_id]
return easy_days_percentages if easy_days_percentages else [1] * 7

def set_fuzz_factor(self, cid: int, reps: int):
Expand Down

0 comments on commit 2be54cf

Please sign in to comment.