Skip to content

Commit

Permalink
Fix entries not being removed if ignore_before_date after the last grade
Browse files Browse the repository at this point in the history
  • Loading branch information
user1823 committed Jan 13, 2025
1 parent 50d6d34 commit 74077df
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rslib/src/scheduler/fsrs/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ pub(crate) fn reviews_for_fsrs(
if idx > 0 {
entries.drain(..idx);
}
} else {
// if no valid user grades were found, drain all entries
entries.drain(..);
}

// Filter out unwanted entries
Expand Down Expand Up @@ -709,4 +712,19 @@ pub(crate) mod tests {
2
);
}

#[test]
fn ignore_before_after_last_revlog_entry() {
let revlogs = &[
revlog(RevlogReviewKind::Learning, 10),
revlog(RevlogReviewKind::Review, 6),
];
// L R |
assert_eq!(
convert_ignore_before(revlogs, false, days_ago_ms(4))
.unwrap()
.len(),
0
);
}
}

0 comments on commit 74077df

Please sign in to comment.