mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
Fix/Ensure fuzz doesn't go backward during rescheduling
Fixes https://github.com/ankitects/anki/issues/2694
This commit is contained in:
parent
436590f4c2
commit
aa351f86d9
1 changed files with 11 additions and 2 deletions
|
|
@ -136,6 +136,15 @@ impl Collection {
|
||||||
let deckconfig_id = deck.config_id().unwrap();
|
let deckconfig_id = deck.config_id().unwrap();
|
||||||
// reschedule it
|
// reschedule it
|
||||||
let original_interval = card.interval;
|
let original_interval = card.interval;
|
||||||
|
// This should ideally use lastIvl from the latest revlog entry.
|
||||||
|
// days_elapsed is used for performance reasons.
|
||||||
|
let greater_than_last = |interval: u32| {
|
||||||
|
if interval > days_elapsed {
|
||||||
|
days_elapsed + 1
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
};
|
||||||
let interval = fsrs.next_interval(
|
let interval = fsrs.next_interval(
|
||||||
Some(state.stability),
|
Some(state.stability),
|
||||||
desired_retention,
|
desired_retention,
|
||||||
|
|
@ -146,7 +155,7 @@ impl Collection {
|
||||||
.and_then(|r| {
|
.and_then(|r| {
|
||||||
r.find_interval(
|
r.find_interval(
|
||||||
interval,
|
interval,
|
||||||
1,
|
greater_than_last(interval as u32).max(1),
|
||||||
req.max_interval,
|
req.max_interval,
|
||||||
days_elapsed as u32,
|
days_elapsed as u32,
|
||||||
deckconfig_id,
|
deckconfig_id,
|
||||||
|
|
@ -157,7 +166,7 @@ impl Collection {
|
||||||
with_review_fuzz(
|
with_review_fuzz(
|
||||||
card.get_fuzz_factor(true),
|
card.get_fuzz_factor(true),
|
||||||
interval,
|
interval,
|
||||||
1,
|
greater_than_last(interval as u32).max(1),
|
||||||
req.max_interval,
|
req.max_interval,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue