Fix/Relearning cards' Intervals don't update after changing Desired Retention (#3236)

* Fix/Relearning cards' Intervals don't update after changing Desired Retention

* cargo clippy --fix
This commit is contained in:
Jarrett Ye 2024-06-22 17:44:02 +08:00 committed by GitHub
parent 9dc3b10fe9
commit 79917bbd2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,6 +52,14 @@ impl RelearnState {
},
}
.into()
} else if let Some(states) = &ctx.fsrs_next_states {
let (minimum, maximum) = ctx.min_and_max_review_intervals(1);
let interval = states.again.interval;
ReviewState {
scheduled_days: ctx.with_review_fuzz(interval as f32, minimum, maximum),
..self.review
}
.into()
} else {
self.review.into()
}
@ -76,6 +84,14 @@ impl RelearnState {
},
}
.into()
} else if let Some(states) = &ctx.fsrs_next_states {
let (minimum, maximum) = ctx.min_and_max_review_intervals(1);
let interval = states.hard.interval;
ReviewState {
scheduled_days: ctx.with_review_fuzz(interval as f32, minimum, maximum),
..self.review
}
.into()
} else {
self.review.into()
}
@ -103,14 +119,29 @@ impl RelearnState {
},
}
.into()
} else if let Some(states) = &ctx.fsrs_next_states {
let (minimum, maximum) = ctx.min_and_max_review_intervals(1);
let interval = states.good.interval;
ReviewState {
scheduled_days: ctx.with_review_fuzz(interval as f32, minimum, maximum),
..self.review
}
.into()
} else {
self.review.into()
}
}
fn answer_easy(self, ctx: &StateContext) -> ReviewState {
let scheduled_days = if let Some(states) = &ctx.fsrs_next_states {
let (minimum, maximum) = ctx.min_and_max_review_intervals(1);
let interval = states.easy.interval;
ctx.with_review_fuzz(interval as f32, minimum, maximum)
} else {
self.review.scheduled_days + 1
};
ReviewState {
scheduled_days: self.review.scheduled_days + 1,
scheduled_days,
elapsed_days: 0,
memory_state: ctx.fsrs_next_states.as_ref().map(|s| s.easy.memory.into()),
..self.review