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
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-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-show-reminder = Show Reminder
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;
$: customSearch = `preset:"${$presetName}"`;
$: desiredRetentionWarning = getRetentionWarning($config.desiredRetention);
let computeRetentionProgress:
| ComputeWeightsProgress
@ -58,6 +59,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$: if (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> {
if (computingWeights) {
await setWantsAbort({});
@ -219,6 +228,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</SettingTitle>
</SpinBoxFloatRow>
<Warning warning={desiredRetentionWarning} className="alert-info" />
<SpinBoxFloatRow
bind:value={$config.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";
export let warning: string;
export let className = "alert-warning";
</script>
{#if warning}
<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)}
</div>
</Row>