diff --git a/Cargo.lock b/Cargo.lock index 0b7146634..992131bc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1457,7 +1457,7 @@ dependencies = [ [[package]] name = "fsrs" version = "0.1.0" -source = "git+https://github.com/open-spaced-repetition/fsrs-rs.git?rev=67163045ba9916e8a41f384fdb5ea414773139bd#67163045ba9916e8a41f384fdb5ea414773139bd" +source = "git+https://github.com/open-spaced-repetition/fsrs-rs.git?rev=96ae7fca09f17723ec514a1d633d36c3a09779f4#96ae7fca09f17723ec514a1d633d36c3a09779f4" dependencies = [ "burn", "itertools 0.11.0", diff --git a/Cargo.toml b/Cargo.toml index a980bbb88..00854443d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ rev = "184b2ca50ed39ca43da13f0b830a463861adb9ca" [workspace.dependencies.fsrs] git = "https://github.com/open-spaced-repetition/fsrs-rs.git" -rev = "67163045ba9916e8a41f384fdb5ea414773139bd" +rev = "96ae7fca09f17723ec514a1d633d36c3a09779f4" # path = "../../../fsrs-rs" [workspace.dependencies] diff --git a/ftl/core/deck-config.ftl b/ftl/core/deck-config.ftl index 59f89160f..fbc61bc15 100644 --- a/ftl/core/deck-config.ftl +++ b/ftl/core/deck-config.ftl @@ -330,6 +330,8 @@ deck-config-which-deck = Which deck would you like to display options for? deck-config-updating-cards = Updating cards: { $current_cards_count }/{ $total_cards_count }... deck-config-invalid-weights = Parameters must be either left blank to use the defaults, or must be 17 comma-separated numbers. deck-config-not-enough-history = Insufficient review history to perform this operation. +deck-config-unable-to-determine-desired-retention = + Unable to determine an optimal retention. deck-config-must-have-1000-reviews = { $count -> [one] Only { $count } review was found. @@ -352,6 +354,7 @@ deck-config-fsrs-on-all-clients = not work correctly if one of your clients is older. deck-config-estimated-retention = Estimated retention: { $num } deck-config-complete = { $num }% complete. +deck-config-iterations = Iteration: { $count }... deck-config-reschedule-cards-on-change = Reschedule cards on change deck-config-fsrs-tooltip = The Free Spaced Repetition Scheduler (FSRS) is an alternative to Anki's legacy SuperMemo 2 (SM2) scheduler. diff --git a/rslib/src/backend/error.rs b/rslib/src/backend/error.rs index 7895d7204..da7addf51 100644 --- a/rslib/src/backend/error.rs +++ b/rslib/src/backend/error.rs @@ -43,6 +43,7 @@ impl AnkiError { AnkiError::InvalidMethodIndex | AnkiError::InvalidServiceIndex | AnkiError::FsrsWeightsInvalid + | AnkiError::FsrsUnableToDetermineDesiredRetention | AnkiError::FsrsInsufficientData => Kind::InvalidInput, #[cfg(windows)] AnkiError::WindowsError { .. } => Kind::OsError, diff --git a/rslib/src/error/mod.rs b/rslib/src/error/mod.rs index 87c128b45..47ad88fbe 100644 --- a/rslib/src/error/mod.rs +++ b/rslib/src/error/mod.rs @@ -115,6 +115,7 @@ pub enum AnkiError { InvalidServiceIndex, FsrsWeightsInvalid, FsrsInsufficientData, + FsrsUnableToDetermineDesiredRetention, SchedulerUpgradeRequired, } @@ -174,6 +175,9 @@ impl AnkiError { } #[cfg(windows)] AnkiError::WindowsError { source } => format!("{source:?}"), + AnkiError::FsrsUnableToDetermineDesiredRetention => tr + .deck_config_unable_to_determine_desired_retention() + .into(), } } diff --git a/rslib/src/scheduler/fsrs/error.rs b/rslib/src/scheduler/fsrs/error.rs index bf25c5d72..fbea5eacf 100644 --- a/rslib/src/scheduler/fsrs/error.rs +++ b/rslib/src/scheduler/fsrs/error.rs @@ -9,6 +9,7 @@ impl From for AnkiError { fn from(err: FSRSError) -> Self { match err { FSRSError::NotEnoughData => AnkiError::FsrsInsufficientData, + FSRSError::OptimalNotFound => AnkiError::FsrsUnableToDetermineDesiredRetention, FSRSError::Interrupted => AnkiError::Interrupted, FSRSError::InvalidWeights => AnkiError::FsrsWeightsInvalid, } diff --git a/rslib/src/scheduler/fsrs/retention.rs b/rslib/src/scheduler/fsrs/retention.rs index d4c8f05ee..444cb1201 100644 --- a/rslib/src/scheduler/fsrs/retention.rs +++ b/rslib/src/scheduler/fsrs/retention.rs @@ -55,7 +55,6 @@ impl Collection { |ip| { anki_progress .update(false, |p| { - p.total = ip.total as u32; p.current = ip.current as u32; }) .is_ok() diff --git a/ts/deck-options/FsrsOptions.svelte b/ts/deck-options/FsrsOptions.svelte index f348fc025..9a0650818 100644 --- a/ts/deck-options/FsrsOptions.svelte +++ b/ts/deck-options/FsrsOptions.svelte @@ -180,10 +180,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html optimalRetentionRequest.search = `preset:"${state.getCurrentName()}"`; const resp = await computeOptimalRetention(optimalRetentionRequest); optimalRetention = resp.optimalRetention; - if (computeRetentionProgress) { - computeRetentionProgress.current = - computeRetentionProgress.total; - } + computeRetentionProgress = undefined; }, (progress) => { if (progress.value.case === "computeRetention") { @@ -217,11 +214,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html function renderRetentionProgress( val: ComputeRetentionProgress | undefined, ): String { - if (!val || !val.total) { + if (!val) { return ""; } - const pct = ((val.current / val.total) * 100).toFixed(0); - return tr.deckConfigComplete({ num: pct }); + return tr.deckConfigIterations({ count: val.current }); } function estimatedRetention(retention: number): String {