diff --git a/rslib/src/deckconfig/mod.rs b/rslib/src/deckconfig/mod.rs index 17088344c..7203aedf1 100644 --- a/rslib/src/deckconfig/mod.rs +++ b/rslib/src/deckconfig/mod.rs @@ -274,7 +274,7 @@ pub(crate) fn ensure_deck_config_values_valid(config: &mut DeckConfigInner) { &mut config.desired_retention, default.desired_retention, 0.7, - 0.97, + 0.99, ); ensure_f32_valid(&mut config.sm2_retention, default.sm2_retention, 0.7, 0.97) } diff --git a/ts/deck-options/FsrsOptions.svelte b/ts/deck-options/FsrsOptions.svelte index c604c7818..afb955c4b 100644 --- a/ts/deck-options/FsrsOptions.svelte +++ b/ts/deck-options/FsrsOptions.svelte @@ -44,6 +44,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html $: computing = computingWeights || checkingWeights || computingRetention; $: customSearch = `preset:"${$presetName}"`; $: desiredRetentionWarning = getRetentionWarning($config.desiredRetention); + $: retentionWarningClass = getRetentionWarningClass($config.desiredRetention); let computeRetentionProgress: | ComputeWeightsProgress @@ -67,6 +68,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } return tr.deckConfigA100DayInterval({ days }); } + + function getRetentionWarningClass(retention: number): string { + if (retention < 0.7 || retention > 0.97) { + return "alert-danger"; + } else if (retention < 0.85 || retention > 0.95) { + return "alert-warning"; + } else { + return "alert-info"; + } + } + async function computeWeights(): Promise { if (computingWeights) { await setWantsAbort({}); @@ -221,14 +233,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html bind:value={$config.desiredRetention} defaultValue={defaults.desiredRetention} min={0.7} - max={0.97} + max={0.99} > openHelpModal("desiredRetention")}> {tr.deckConfigDesiredRetention()} - +