From 17cfec5e35258f50833572849ae4a85d66602545 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 25 Sep 2023 16:17:00 +1000 Subject: [PATCH] Prohibit weight generation when reps < 1000 --- ftl/core/deck-config.ftl | 4 ++-- ts/deck-options/FsrsOptions.svelte | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ftl/core/deck-config.ftl b/ftl/core/deck-config.ftl index 2dc9ff523..2356e35b3 100644 --- a/ftl/core/deck-config.ftl +++ b/ftl/core/deck-config.ftl @@ -315,11 +315,11 @@ deck-config-which-deck = Which deck would you like to display options for? deck-config-updating-cards = Updating cards: { $current_cards_count }/{ $total_cards_count }... deck-config-invalid-weights = Weights must be either left blank to use the defaults, or must be 17 comma-separated numbers. deck-config-not-enough-history = Insufficient review history to perform this operation. -deck-config-limited-history = +deck-config-must-have-1000-reviews = { $count -> [one] Only { $count } review was found. *[other] Only { $count } reviews were found. - } The custom weights are likely to be inaccurate, and using the defaults instead is recommended. + } You must have at least 1000 reviews to generate custom weights. deck-config-compute-weights-search = Search; leave blank for all cards using this preset # Numbers that control how aggressively the FSRS algorithm schedules cards deck-config-weights = Model weights diff --git a/ts/deck-options/FsrsOptions.svelte b/ts/deck-options/FsrsOptions.svelte index d1604ff41..448b5460d 100644 --- a/ts/deck-options/FsrsOptions.svelte +++ b/ts/deck-options/FsrsOptions.svelte @@ -20,7 +20,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import SettingTitle from "../components/SettingTitle.svelte"; import type { DeckOptionsState } from "./lib"; import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte"; - import Warning from "./Warning.svelte"; import WeightsInputRow from "./WeightsInputRow.svelte"; export let state: DeckOptionsState; @@ -31,7 +30,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const defaults = state.defaults; let computeWeightsProgress: ComputeWeightsProgress | undefined; - let computeWeightsWarning = ""; let computing = false; $: customSearch = `preset:"${$presetName}"`; @@ -64,13 +62,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html computeWeightsProgress.current = computeWeightsProgress.total; } if (resp.fsrsItems < 1000) { - computeWeightsWarning = tr.deckConfigLimitedHistory({ - count: resp.fsrsItems, - }); + alert( + tr.deckConfigMustHave1000Reviews({ count: resp.fsrsItems }), + ); } else { - computeWeightsWarning = ""; + $config.fsrsWeights = resp.weights; } - $config.fsrsWeights = resp.weights; }, (progress) => { if (progress.value.case === "computeWeights") { @@ -228,7 +225,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/if} {#if computing}
{computeWeightsProgressString}
{/if} -