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-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

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 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}
</button>
{#if computing}<div>{computeWeightsProgressString}</div>{/if}
<Warning warning={computeWeightsWarning} />
</details>
</div>