Skip to content

Commit

Permalink
Fix/flatten cards respect easy days
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Sep 25, 2024
1 parent be3cd50 commit ee308f9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions schedule/flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@ def flatten_background(did, desired_flatten_limit):
if rest_cnt <= 0:
break
due_date = current_date + timedelta(days=new_due - today)
if config.load_balance:
if random.random() < easy_days_review_ratio_list[due_date.weekday()]:
continue
due_cnt = due_cnt_per_day[new_due]
if due_cnt > desired_flatten_limit:
today_limit = (
int(desired_flatten_limit * easy_days_review_ratio_list[due_date.weekday()])
if config.load_balance
else desired_flatten_limit
)
quota = today_limit - due_cnt
if quota <= 0:
continue
quota = desired_flatten_limit - due_cnt
start_index = cnt
end_index = cnt + min(quota, rest_cnt)
for cid, _, ivl in cards_to_flatten[start_index:end_index]:
Expand Down

0 comments on commit ee308f9

Please sign in to comment.