Prohibit weight generation when reps < 1000

This commit is contained in:
Damien Elmes 2023-09-25 16:17:00 +10:00
parent e0399bcad2
commit 17cfec5e35
2 changed files with 6 additions and 10 deletions

View file

@ -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-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-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-not-enough-history = Insufficient review history to perform this operation.
deck-config-limited-history = deck-config-must-have-1000-reviews =
{ $count -> { $count ->
[one] Only { $count } review was found. [one] Only { $count } review was found.
*[other] Only { $count } reviews were 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 deck-config-compute-weights-search = Search; leave blank for all cards using this preset
# Numbers that control how aggressively the FSRS algorithm schedules cards # Numbers that control how aggressively the FSRS algorithm schedules cards
deck-config-weights = Model weights deck-config-weights = Model weights

View file

@ -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 SettingTitle from "../components/SettingTitle.svelte";
import type { DeckOptionsState } from "./lib"; import type { DeckOptionsState } from "./lib";
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte"; import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
import Warning from "./Warning.svelte";
import WeightsInputRow from "./WeightsInputRow.svelte"; import WeightsInputRow from "./WeightsInputRow.svelte";
export let state: DeckOptionsState; 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; const defaults = state.defaults;
let computeWeightsProgress: ComputeWeightsProgress | undefined; let computeWeightsProgress: ComputeWeightsProgress | undefined;
let computeWeightsWarning = "";
let computing = false; let computing = false;
$: customSearch = `preset:"${$presetName}"`; $: 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; computeWeightsProgress.current = computeWeightsProgress.total;
} }
if (resp.fsrsItems < 1000) { if (resp.fsrsItems < 1000) {
computeWeightsWarning = tr.deckConfigLimitedHistory({ alert(
count: resp.fsrsItems, tr.deckConfigMustHave1000Reviews({ count: resp.fsrsItems }),
}); );
} else { } else {
computeWeightsWarning = "";
}
$config.fsrsWeights = resp.weights; $config.fsrsWeights = resp.weights;
}
}, },
(progress) => { (progress) => {
if (progress.value.case === "computeWeights") { 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}
</button> </button>
{#if computing}<div>{computeWeightsProgressString}</div>{/if} {#if computing}<div>{computeWeightsProgressString}</div>{/if}
<Warning warning={computeWeightsWarning} />
</details> </details>
</div> </div>