Skip to content

Commit

Permalink
read config.easy_dates when rescheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed May 18, 2024
1 parent 73a61af commit 07cad97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions schedule/easy_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ def __init__(self):
self.initUi()
self.config = Config()
self.config.load()
today = datetime.today().date()
current_date = sched_current_date()
self.config.easy_dates = [
date
for date in self.config.easy_dates
if datetime.strptime(date, "%Y-%m-%d").date() >= today
if datetime.strptime(date, "%Y-%m-%d").date() >= current_date
]
self.specific_dates = [
datetime.strptime(date, "%Y-%m-%d").date()
Expand Down
10 changes: 10 additions & 0 deletions schedule/reschedule.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Set
from aqt import QAction, browser

from .disperse_siblings import disperse_siblings
Expand Down Expand Up @@ -212,6 +213,15 @@ def reschedule_background(
len(fsrs.easy_days), fsrs.easy_days_review_ratio
)
fsrs.easy_specific_due_dates = easy_specific_due_dates

current_date = sched_current_date()
today = mw.col.sched.today
for easy_date_str in config.easy_dates:
easy_date = datetime.strptime(easy_date_str, "%Y-%m-%d").date()
specific_due = today + (easy_date - current_date).days
if specific_due not in fsrs.easy_specific_due_dates:
fsrs.easy_specific_due_dates.append(specific_due)

fsrs.p_obey_specific_due_dates = obey_specific_due_dates(
len(fsrs.easy_specific_due_dates), fsrs.easy_days_review_ratio
)
Expand Down

0 comments on commit 07cad97

Please sign in to comment.