Skip to content

Commit ef37952

Browse files
authored
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
1 parent 92cfb73 commit ef37952

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ rreemmii-dev <https://github.com/rreemmii-dev>
224224
babofitos <https://github.com/babofitos>
225225
Jonathan Schoreels <https://github.com/JSchoreels>
226226
JL710
227+
Matt Brubeck <mbrubeck@limpet.net>
227228

228229
********************
229230

rslib/src/scheduler/fsrs/params.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,6 @@ pub(crate) fn reviews_for_fsrs(
322322
if user_graded && entry.review_kind == RevlogReviewKind::Learning {
323323
first_of_last_learn_entries = Some(index);
324324
revlogs_complete = true;
325-
} else if first_of_last_learn_entries.is_some() {
326-
break;
327325
} else if matches!(
328326
(entry.review_kind, entry.ease_factor),
329327
(RevlogReviewKind::Manual, 0)
@@ -343,6 +341,10 @@ pub(crate) fn reviews_for_fsrs(
343341
} else {
344342
return None;
345343
}
344+
// Previous versions of Anki didn't add a revlog entry when the card was
345+
// reset.
346+
} else if first_of_last_learn_entries.is_some() {
347+
break;
346348
}
347349
}
348350
if training {

0 commit comments

Comments
 (0)