Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/don't reschedule to the past when today is easy day #428

Merged

Conversation

L-M-Sherlock
Copy link
Member

No description provided.

@L-M-Sherlock L-M-Sherlock added the bug Something isn't working label Jul 2, 2024
@L-M-Sherlock L-M-Sherlock linked an issue Jul 2, 2024 that may be closed by this pull request
3 tasks
@L-M-Sherlock L-M-Sherlock merged commit 4f1d969 into main Jul 6, 2024
2 checks passed
@L-M-Sherlock L-M-Sherlock deleted the Fix/don't-reschedule-to-the-past-when-today-is-easy-day branch July 6, 2024 08:53
@user1823
Copy link
Contributor

user1823 commented Jul 6, 2024

Why do we need allow_to_past to be True in some cases? Shouldn't it always be False?

My reasoning:
If the latest possible due date is in the past, the load balancing is skipped. So, allow_to_past is used only for those cards that have some possible due dates in the future. Moving such cards to the past doesn't make sense because the user can't do them in the past.

(If the latest possible due date is in the past, rescheduling to the past still makes some sense because the card is beyond its due range now.)

@L-M-Sherlock
Copy link
Member Author

Why do we need allow_to_past to be True in some cases? Shouldn't it always be False?

For example, the user increases the desired retention.

@user1823
Copy link
Contributor

user1823 commented Jul 6, 2024

But in that case, the following code will make the card due in the past.

if due - self.card.ivl + max_ivl <= mw.col.sched.today:
# If the latest possible due date is in the past, skip load balance
return ivl

@L-M-Sherlock
Copy link
Member Author

But in that case, the following code will make the card due in the past.

It's intended. The load balance also tries to balance the backlog and the future workload.

@user1823
Copy link
Contributor

user1823 commented Jul 7, 2024

I am not saying that those cards should not be scheduled in the past.

I am saying that this code (line 91-93) is enough to ensure that the cards are scheduled in the past when the user increases the desired retention (or updates the parameters). So, you don't need to set allow_to_past to True.

@L-M-Sherlock
Copy link
Member Author

But it doesn't affect those cards whose fuzz ranges include today.

@user1823
Copy link
Contributor

user1823 commented Jul 7, 2024

Yes, but what benefit do you get by scheduling a card yesterday (or any other past day) instead of today?

I mean, if the fuzz ranges allows scheduling the card today, why not schedule it today?

Edit:
Do you mean that I should remove the = sign from that code so that it becomes this?

 if due - self.card.ivl + max_ivl < mw.col.sched.today: 
     # If the latest possible due date is in the past, skip load balance 
     return ivl 

@L-M-Sherlock
Copy link
Member Author

It makes the future due graph looks smoother because the cards due in yesterday are included in the backlog which is hidden by default.

@user1823
Copy link
Contributor

user1823 commented Jul 7, 2024

With the current load balancer, the graph will NOT look smooth when there is a backlog.

Reason:
Today's workload includes the backlog but tomorrow's workload doesn't.

# If the due date is in the future, the workload is the number of cards due on that day
workload = self.due_cnt_per_day[check_due]
else:
# If the due date is in the past or today, the workload is the number of cards due today plus the number of cards learned today
workload = self.due_today + self.reviewed_today

self.due_today = sum(
due_cnt
for due, due_cnt in self.due_cnt_per_day.items()
if due <= mw.col.sched.today
)

So, with the current code, after load balancing, today's due count in the Future Due graph will lesser than tomorrow's because today's due count doesn't include the backlog.

If the cards are scheduled today instead of the past (like in my PR), they will be included in today's due count so the graph will be more smooth.

@user1823
Copy link
Contributor

user1823 commented Jul 7, 2024

Proof:
In the screenshots below, see how the current code makes the today's due count 0 in the Future Due Graph.

Current code:

My code:

@L-M-Sherlock
Copy link
Member Author

OK. I will check the PR tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Easy Day correct usage
2 participants