mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Check if self.card.reps>0 before substracing 1 (#3966)
* Check if self.card.reps>0 before substracing 1 * Fix formatting * Use a more rust-y way to avoid the Panic for underflow, especially wé're talking seed value Co-Authored-By: jake <jake@sharnoth.com> --------- Co-authored-by: jake <jake@sharnoth.com>
This commit is contained in:
parent
ad12046e87
commit
963fcf7c60
1 changed files with 1 additions and 1 deletions
|
@ -71,7 +71,7 @@ impl CardStateUpdater {
|
||||||
// Decrease reps by 1 to get correct seed for fuzz.
|
// Decrease reps by 1 to get correct seed for fuzz.
|
||||||
// If the fuzz calculation changes, this will break.
|
// If the fuzz calculation changes, this will break.
|
||||||
let last_ivl_with_fuzz = self.learning_ivl_with_fuzz(
|
let last_ivl_with_fuzz = self.learning_ivl_with_fuzz(
|
||||||
get_fuzz_seed_for_id_and_reps(self.card.id, self.card.reps - 1),
|
get_fuzz_seed_for_id_and_reps(self.card.id, self.card.reps.wrapping_sub(1)),
|
||||||
last_ivl,
|
last_ivl,
|
||||||
);
|
);
|
||||||
let last_answered_time = due as i64 - last_ivl_with_fuzz as i64;
|
let last_answered_time = due as i64 - last_ivl_with_fuzz as i64;
|
||||||
|
|
Loading…
Reference in a new issue