Add an info box so the non-linear nature of desired retention can be seen

This commit is contained in:
Damien Elmes 2023-11-06 12:04:31 +10:00
parent 59acde45a1
commit e2ee6b7d44
3 changed files with 19 additions and 1 deletions

View File

@ -390,6 +390,12 @@ deck-config-compute-optimal-retention-tooltip =
or too high for the amount of cards you're trying to learn. This number can be useful as a reference, but it or too high for the amount of cards you're trying to learn. This number can be useful as a reference, but it
is not recommended to copy it into the desired retention field. is not recommended to copy it into the desired retention field.
deck-config-please-save-your-changes-first = Please save your changes first. deck-config-please-save-your-changes-first = Please save your changes first.
deck-config-a-100-day-interval =
{ $days ->
[one] A 100 day interval will become { $days } day.
*[other] A 100 day interval will become { $days } days.
}
deck-config-wait-for-audio = Wait for audio deck-config-wait-for-audio = Wait for audio
deck-config-show-reminder = Show Reminder deck-config-show-reminder = Show Reminder
deck-config-answer-again = Answer Again deck-config-answer-again = Answer Again

View File

@ -43,6 +43,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);
let computeRetentionProgress: let computeRetentionProgress:
| ComputeWeightsProgress | ComputeWeightsProgress
@ -58,6 +59,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$: if (optimalRetentionRequest.daysToSimulate > 3650) { $: if (optimalRetentionRequest.daysToSimulate > 3650) {
optimalRetentionRequest.daysToSimulate = 3650; optimalRetentionRequest.daysToSimulate = 3650;
} }
function getRetentionWarning(retention: number): string {
const days = Math.round(9 * 100 * (1.0 / retention - 1.0));
if (days === 100) {
return "";
}
return tr.deckConfigA100DayInterval({ days });
}
async function computeWeights(): Promise<void> { async function computeWeights(): Promise<void> {
if (computingWeights) { if (computingWeights) {
await setWantsAbort({}); await setWantsAbort({});
@ -219,6 +228,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</SettingTitle> </SettingTitle>
</SpinBoxFloatRow> </SpinBoxFloatRow>
<Warning warning={desiredRetentionWarning} className="alert-info" />
<SpinBoxFloatRow <SpinBoxFloatRow
bind:value={$config.sm2Retention} bind:value={$config.sm2Retention}
defaultValue={defaults.sm2Retention} defaultValue={defaults.sm2Retention}

View File

@ -9,11 +9,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import Row from "../components/Row.svelte"; import Row from "../components/Row.svelte";
export let warning: string; export let warning: string;
export let className = "alert-warning";
</script> </script>
{#if warning} {#if warning}
<Row> <Row>
<div class="col-12 alert alert-warning mb-0" in:slide out:slide> <div class="col-12 alert {className} mb-0" in:slide out:slide>
{withoutUnicodeIsolation(warning)} {withoutUnicodeIsolation(warning)}
</div> </div>
</Row> </Row>