From 624b59690c02cf77ac16369441eeb1a94c676fac Mon Sep 17 00:00:00 2001 From: user1823 <92206575+user1823@users.noreply.github.com> Date: Thu, 25 Sep 2025 19:34:05 +0530 Subject: [PATCH] Get previous_interval from LastRevlogInfo --- rslib/src/scheduler/fsrs/memory_state.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rslib/src/scheduler/fsrs/memory_state.rs b/rslib/src/scheduler/fsrs/memory_state.rs index 74e6033a1..64704545f 100644 --- a/rslib/src/scheduler/fsrs/memory_state.rs +++ b/rslib/src/scheduler/fsrs/memory_state.rs @@ -136,11 +136,10 @@ impl Collection { let deckconfig_id = deck.config_id().unwrap(); // reschedule it let original_interval = card.interval; - // This should ideally use lastIvl from latest revlog. - // days_elapsed is used for performance reasons. let greater_than_last = |interval: u32| { - if interval > days_elapsed as u32 { - days_elapsed as u32 + 1 + let previous_interval = last_info.previous_interval as u32 + if interval > previous_interval { + previous_interval + 1 } else { 0 } @@ -319,6 +318,9 @@ pub(crate) struct LastRevlogInfo { /// reviewed the card and now, so that we can determine an accurate period /// when the card has subsequently been rescheduled to a different day. pub(crate) last_reviewed_at: Option, + /// The interval before the latest review. Used to prevent fuzz from going + /// backwards when rescheduling the card + pub(crate) previous_interval: Option, } /// Return a map of cards to info about last review. @@ -330,14 +332,20 @@ pub(crate) fn get_last_revlog_info(revlogs: &[RevlogEntry]) -> HashMap