Remove dead code in reviews_for_fsrs (#3958)

* Clarify logic in reviews_for_fsrs

Prior to this change, the second check of `first_of_last_learn_entries`
was dead code because the first check would always break out of the loop
before it could succeed.  Re-order the code for clarity and add a
comment to explain the logic.

* Update CONTRIBUTORS
This commit is contained in:
Matt Brubeck 2025-04-30 04:28:30 -07:00 committed by GitHub
parent 92cfb7340e
commit ef37952ba0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -224,6 +224,7 @@ rreemmii-dev <https://github.com/rreemmii-dev>
babofitos <https://github.com/babofitos>
Jonathan Schoreels <https://github.com/JSchoreels>
JL710
Matt Brubeck <mbrubeck@limpet.net>
********************

View file

@ -322,8 +322,6 @@ pub(crate) fn reviews_for_fsrs(
if user_graded && entry.review_kind == RevlogReviewKind::Learning {
first_of_last_learn_entries = Some(index);
revlogs_complete = true;
} else if first_of_last_learn_entries.is_some() {
break;
} else if matches!(
(entry.review_kind, entry.ease_factor),
(RevlogReviewKind::Manual, 0)
@ -343,6 +341,10 @@ pub(crate) fn reviews_for_fsrs(
} else {
return None;
}
// Previous versions of Anki didn't add a revlog entry when the card was
// reset.
} else if first_of_last_learn_entries.is_some() {
break;
}
}
if training {