Skip to content

Commit

Permalink
Fix/ignore revlogs when there is not learn entry after the last forge…
Browse files Browse the repository at this point in the history
…t entry (#3199)
  • Loading branch information
L-M-Sherlock authored May 17, 2024
1 parent 7099614 commit 2b890b0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions rslib/src/scheduler/fsrs/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,20 @@ pub(crate) fn single_card_revlog_to_items(
revlogs_complete = true;
} else if first_of_last_learn_entries.is_some() {
break;
// if we find the `Forget` entry before the `Learn` entry, we should
// ignore all the entries
} else if matches!(
(entry.review_kind, entry.ease_factor),
(RevlogReviewKind::Manual, 0)
) && first_of_last_learn_entries.is_none()
{
revlogs_complete = false;
break;
) {
// If we find a `Learn` entry after the `Forget` entry, we should
// ignore the entries before the `Forget` entry
if first_of_last_learn_entries.is_some() {
revlogs_complete = false;
break;
// If we don't find a `Learn` entry after the `Forget` entry, it's
// a new card and we should ignore all entries
} else {
return None;
}
}
}
if !revlogs_complete {
Expand Down

0 comments on commit 2b890b0

Please sign in to comment.