Ensure minimum doesn't exceed maximum

With a maximum interval set, it would be possible to confuse with_review_fuzz()
by passing min > max.
This commit is contained in:
Damien Elmes 2024-06-28 19:18:15 +08:00
parent da257eead2
commit 37ce4e8426

View file

@ -135,8 +135,11 @@ impl RelearnState {
fn answer_easy(self, ctx: &StateContext) -> ReviewState {
let scheduled_days = if let Some(states) = &ctx.fsrs_next_states {
let (mut minimum, maximum) = ctx.min_and_max_review_intervals(1);
// ensure 1 greater than good where possible
let good = ctx.with_review_fuzz(states.good.interval as f32, minimum, maximum);
minimum = good + 1;
if minimum < maximum {
minimum = good + 1;
}
let interval = states.easy.interval;
ctx.with_review_fuzz(interval as f32, minimum, maximum)
} else {