-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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/fallback to non-manual entry when first_of_last_learn_entries non found #3639
Fix/fallback to non-manual entry when first_of_last_learn_entries non found #3639
Conversation
Just to be sure, Did you try this on a card that has no entries after a reset entry? |
Wait a minute... The |
@dae, sorry for bothering you, but I don't understand this snippet of code: anki/rslib/src/scheduler/fsrs/params.rs Lines 289 to 300 in d900506
What's the aim of it? |
Introduced in db93939. I believe the goal was to treat them as complete even if no learning entries have been found, if they started with a reschedule? |
Dae added that code to implement my suggestion in open-spaced-repetition/fsrs4anki#540 (comment) The issue: open-spaced-repetition/fsrs4anki#557 If the user uses Set Due Date to introduce a card rather than by normal way, the cards were getting very high difficulty. Basically, it is the same issue that has been discussed many times in open-spaced-repetition/fsrs4anki#675. |
My PR will infer the memory state from the first non-manual entry aftet |
In open-spaced-repetition/fsrs4anki#675, I suggested removing this snippet. So, I think that you can remove it. |
OK, here is the next problem: anki/rslib/src/scheduler/fsrs/memory_state.rs Lines 287 to 299 in d900506
I think anki/rslib/src/scheduler/fsrs/memory_state.rs Lines 300 to 315 in d900506
The current code infers the memory state from the |
Your suggestion seems reasonable to me. |
So this unit test should be removed. anki/rslib/src/scheduler/fsrs/memory_state.rs Lines 397 to 421 in d900506
|
OK, the next problem: If we find a relearning entry, should we set the revlogs_complete to true? |
What did the previous code do? I will have to search through previous discussions for reasoning for/against this. Unfortunately, I won't be able to devote much time today and tomorrow. |
On a gross overview, the changes made till now look good to me. |
Here is the previous code: anki/rslib/src/scheduler/fsrs/params.rs Lines 327 to 338 in d900506
It was introduced in 90b0c6d |
If the previous code set it to true, then let's keep it that way. There must be some reason why it was done like that. |
In previous code, |
If |
My initial answer would be NO. But, what does 90b0c6d do? |
Does this PR also fix #2921? |
This comment was marked as resolved.
This comment was marked as resolved.
Yes. The |
If the |
Using normal formula or using memory_state_from_sm2? Let's keep doing whatever Anki was doing before this PR. It would have better if we had a link to discussion in the commit message of 90b0c6d. |
Using normal formula. But it was changed in db93939. This commit introduced |
Well, if this is what has happened, using |
Next issue/suggestion: We should also exclude cram revlogs (entry.review_kind == RevlogReviewKind::Filtered && entry.ease_factor == 0) here. if matches!(entry.button_chosen, 1..=4) {
non_manual_entries = Some(index);
} This is the last suggestion from me for today. I will take another look tomorrow to ensure that no issue is remaining and then we can request dae for a final review. By the way, thanks for this PR. You have squashed tons of bugs with this. |
I refactored a lot of codes. Cram revlogs are skipped for (index, entry) in entries.iter().enumerate().rev() {
if entry.review_kind == RevlogReviewKind::Filtered && entry.ease_factor == 0 {
continue;
} Only search the first non-manual revlog entry after ignore date if matches!(entry.button_chosen, 1..=4) && entry.id.0 > ignore_revlogs_before.0 {
non_manual_entries = Some(index);
} Fallback to non-manual revlog entry if the first of last learn entires is before ignore dateI referred to your idea: #2922 (comment) // While reviewing if the first learning step is before the ignore date,
// fallback to non_manual_entries
if let Some(idx) = first_of_last_learn_entries {
if entries[idx].id.0 < ignore_revlogs_before.0 && idx < entries.len() - 1 {
revlogs_complete = false;
first_of_last_learn_entries = None;
}
} |
- fsrs_items_for_memory_state - fsrs_items_for_memory_states - single_card_revlog_to_item -> fsrs_item_for_memory_state (to match fsrs_items_for_training) - single_card_revlog_to_items -> reviews_for_fsrs - Use struct instead of tuple for reviews_for_fsrs output - Don't return count, since we're already returning the filtered list
Sorry, I forgot we iterate on the entries in reverse, which I think has made my renaming incorrect. Reviewing... |
- non_manual_entries -> first_user_grade_idx - change comments to reflect the fact that we're working backwards - Use "user-graded" rather than "non-manual"
c056189
to
7fd9a77
Compare
Ok, sorry about the delay. Tests past after the changes in the last commit, but I'm not 100% confident the behaviour is identical - can you spot any problems? |
For this case, the
|
The last commit (7fd9a77) has introduced a functional change (I think) and it isn't desirable. After the above commit, if a card has revlog entries like
where | = cutoff date Maybe, this type of revlog entry requires a unit test because it is too easy to break. |
Apart from the above mentioned functional issue, the code looks good to me. However, I have some suggestions regarding wording: memory_state.rs
to
params.rs
to
to
|
7fd9a77
to
51d2d61
Compare
Thank you both, I've reverted my changes and applied some of the other suggestions. |
Covers most of the cases encountered in ankitects#3639
* Add some unit tests Covers most of the cases encountered in #3639 * Format * Update params.rs Makes the test more robust. * Update params.rs When training, the first FSRS item is removed. That's why none of the other tests includes it. Co-authored-by: Jarrett Ye <[email protected]> * Improve naming * Fix typo --------- Co-authored-by: Jarrett Ye <[email protected]>
Complements the change in ankitects#3639, ensuring that scheduler and rescheduling produce the same results.
Complements the change in #3639, ensuring that scheduler and rescheduling produce the same results.
fix #3634