diff --git a/ftl/core/deck-config.ftl b/ftl/core/deck-config.ftl index f7c7ff950..3bf817754 100644 --- a/ftl/core/deck-config.ftl +++ b/ftl/core/deck-config.ftl @@ -337,7 +337,7 @@ deck-config-get-params = Get Params deck-config-fsrs-on-all-clients = Please ensure all of your Anki clients are Anki(Mobile) 23.10+ or AnkiDroid 2.17+. FSRS will not work correctly if one of your clients is older. -deck-config-your-optimal-retention = Your optimal retention is { $num }. +deck-config-set-optimal-retention = Set desired retention to { $num } ## NO NEED TO TRANSLATE. This text is no longer used by Anki, and will be removed in the future. diff --git a/ts/deck-options/FsrsOptions.svelte b/ts/deck-options/FsrsOptions.svelte index 7a33b7780..610d483b3 100644 --- a/ts/deck-options/FsrsOptions.svelte +++ b/ts/deck-options/FsrsOptions.svelte @@ -33,6 +33,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let computingWeights = false; let checkingWeights = false; let computingRetention = false; + let optimalRetention = 0; + $: if ($presetName) { + optimalRetention = 0; + } $: computing = computingWeights || checkingWeights || computingRetention; $: customSearch = `preset:"${$presetName}"`; @@ -136,11 +140,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html optimalRetentionRequest.weights = $config.fsrsWeights; optimalRetentionRequest.search = `preset:"${state.getCurrentName()}"`; const resp = await computeOptimalRetention(optimalRetentionRequest); - alert( - tr.deckConfigYourOptimalRetention({ - num: resp.optimalRetention, - }), - ); + optimalRetention = resp.optimalRetention; if (computeRetentionProgress) { computeRetentionProgress.current = computeRetentionProgress.total; @@ -184,6 +184,20 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const pct = ((val.current / val.total) * 100).toFixed(0); return `${pct}%`; } + + function stringForSetOptimalRetention(retention: number): String { + if (!retention) { + return ""; + } + return tr.deckConfigSetOptimalRetention({ num: retention.toFixed(2) }); + } + + function setDesiredRetentionToOptimal() { + if (!optimalRetention) { + return; + } + $config.desiredRetention = optimalRetention; + } + + {#if optimalRetention} + + {/if}
{computeRetentionProgressString}