From ef37952ba00b4c897ecbd5d1a0f3ca08ef6141ab Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 30 Apr 2025 04:28:30 -0700 Subject: [PATCH 1/3] Remove dead code in reviews_for_fsrs (#3958) * Clarify logic in reviews_for_fsrs Prior to this change, the second check of `first_of_last_learn_entries` was dead code because the first check would always break out of the loop before it could succeed. Re-order the code for clarity and add a comment to explain the logic. * Update CONTRIBUTORS --- CONTRIBUTORS | 1 + rslib/src/scheduler/fsrs/params.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8dfeed4cf..ae6817aea 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -224,6 +224,7 @@ rreemmii-dev babofitos Jonathan Schoreels JL710 +Matt Brubeck ******************** diff --git a/rslib/src/scheduler/fsrs/params.rs b/rslib/src/scheduler/fsrs/params.rs index d313a6851..276150676 100644 --- a/rslib/src/scheduler/fsrs/params.rs +++ b/rslib/src/scheduler/fsrs/params.rs @@ -322,8 +322,6 @@ pub(crate) fn reviews_for_fsrs( if user_graded && entry.review_kind == RevlogReviewKind::Learning { first_of_last_learn_entries = Some(index); revlogs_complete = true; - } else if first_of_last_learn_entries.is_some() { - break; } else if matches!( (entry.review_kind, entry.ease_factor), (RevlogReviewKind::Manual, 0) @@ -343,6 +341,10 @@ pub(crate) fn reviews_for_fsrs( } else { return None; } + // Previous versions of Anki didn't add a revlog entry when the card was + // reset. + } else if first_of_last_learn_entries.is_some() { + break; } } if training { From ad12046e87ca9b92303c27a305228540fdf728ed Mon Sep 17 00:00:00 2001 From: sorata Date: Wed, 30 Apr 2025 17:14:11 +0530 Subject: [PATCH 2/3] Improve an Error Message (#3964) * improve a string * Update ftl/core/deck-config.ftl --- ftl/core/deck-config.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftl/core/deck-config.ftl b/ftl/core/deck-config.ftl index 461c6a25a..12512acb0 100644 --- a/ftl/core/deck-config.ftl +++ b/ftl/core/deck-config.ftl @@ -484,7 +484,7 @@ deck-config-percent-input = { $pct }% deck-config-optimizing-preset = Optimizing preset { $current_count }/{ $total_count }... deck-config-fsrs-must-be-enabled = FSRS must be enabled first. deck-config-fsrs-params-optimal = The FSRS parameters currently appear to be optimal. -deck-config-fsrs-params-no-reviews = No reviews found. Please check that this preset is assigned to all decks you want to optimize (including subdecks) and try again. +deck-config-fsrs-params-no-reviews = No reviews found. Make sure this preset is assigned to all decks (including subdecks) that you want to optimize, and try again. deck-config-wait-for-audio = Wait for audio deck-config-show-reminder = Show Reminder From 963fcf7c6078273093575cbc652284b7bf7d4a97 Mon Sep 17 00:00:00 2001 From: Jonathan Schoreels Date: Wed, 30 Apr 2025 13:53:36 +0200 Subject: [PATCH 3/3] Check if self.card.reps>0 before substracing 1 (#3966) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --------- Co-authored-by: jake --- rslib/src/scheduler/answering/current.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rslib/src/scheduler/answering/current.rs b/rslib/src/scheduler/answering/current.rs index c40513a18..65eb87044 100644 --- a/rslib/src/scheduler/answering/current.rs +++ b/rslib/src/scheduler/answering/current.rs @@ -71,7 +71,7 @@ impl CardStateUpdater { // Decrease reps by 1 to get correct seed for fuzz. // If the fuzz calculation changes, this will break. 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, ); let last_answered_time = due as i64 - last_ivl_with_fuzz as i64;