mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Change color of info box depending on retention; increase limit to 0.99
Closes #2803
This commit is contained in:
parent
0b8b168df1
commit
82aaa913a6
2 changed files with 15 additions and 3 deletions
|
@ -274,7 +274,7 @@ pub(crate) fn ensure_deck_config_values_valid(config: &mut DeckConfigInner) {
|
||||||
&mut config.desired_retention,
|
&mut config.desired_retention,
|
||||||
default.desired_retention,
|
default.desired_retention,
|
||||||
0.7,
|
0.7,
|
||||||
0.97,
|
0.99,
|
||||||
);
|
);
|
||||||
ensure_f32_valid(&mut config.sm2_retention, default.sm2_retention, 0.7, 0.97)
|
ensure_f32_valid(&mut config.sm2_retention, default.sm2_retention, 0.7, 0.97)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
$: computing = computingWeights || checkingWeights || computingRetention;
|
$: computing = computingWeights || checkingWeights || computingRetention;
|
||||||
$: customSearch = `preset:"${$presetName}"`;
|
$: customSearch = `preset:"${$presetName}"`;
|
||||||
$: desiredRetentionWarning = getRetentionWarning($config.desiredRetention);
|
$: desiredRetentionWarning = getRetentionWarning($config.desiredRetention);
|
||||||
|
$: retentionWarningClass = getRetentionWarningClass($config.desiredRetention);
|
||||||
|
|
||||||
let computeRetentionProgress:
|
let computeRetentionProgress:
|
||||||
| ComputeWeightsProgress
|
| ComputeWeightsProgress
|
||||||
|
@ -67,6 +68,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
return tr.deckConfigA100DayInterval({ days });
|
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<void> {
|
async function computeWeights(): Promise<void> {
|
||||||
if (computingWeights) {
|
if (computingWeights) {
|
||||||
await setWantsAbort({});
|
await setWantsAbort({});
|
||||||
|
@ -221,14 +233,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
bind:value={$config.desiredRetention}
|
bind:value={$config.desiredRetention}
|
||||||
defaultValue={defaults.desiredRetention}
|
defaultValue={defaults.desiredRetention}
|
||||||
min={0.7}
|
min={0.7}
|
||||||
max={0.97}
|
max={0.99}
|
||||||
>
|
>
|
||||||
<SettingTitle on:click={() => openHelpModal("desiredRetention")}>
|
<SettingTitle on:click={() => openHelpModal("desiredRetention")}>
|
||||||
{tr.deckConfigDesiredRetention()}
|
{tr.deckConfigDesiredRetention()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
</SpinBoxFloatRow>
|
</SpinBoxFloatRow>
|
||||||
|
|
||||||
<Warning warning={desiredRetentionWarning} className="alert-info" />
|
<Warning warning={desiredRetentionWarning} className={retentionWarningClass} />
|
||||||
|
|
||||||
<SpinBoxFloatRow
|
<SpinBoxFloatRow
|
||||||
bind:value={$config.sm2Retention}
|
bind:value={$config.sm2Retention}
|
||||||
|
|
Loading…
Reference in a new issue