Add "No reviews to optimize" message (#3610)

* Separate failed message from optimal

* No reviews only

* Fix: Can't block optimize if not optimal

* Wording change

* Update ftl/core/deck-config.ftl

* Simplify code (dae)
This commit is contained in:
Luc Mcgrady 2024-12-09 04:21:58 +00:00 committed by GitHub
parent 039c7fc0a9
commit d6ffaa921f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -452,6 +452,7 @@ deck-config-percent-of-reviews =
deck-config-optimizing-preset = Optimizing preset { $current_count }/{ $total_count }...
deck-config-fsrs-must-be-enabled = FSRS must be enabled first.
deck-config-fsrs-params-optimal = The FSRS parameters currently appear to be optimal.
deck-config-fsrs-params-no-reviews = No reviews found. Please check that this preset is assigned to all decks you want to optimize (including subdecks) and try again.
deck-config-wait-for-audio = Wait for audio
deck-config-show-reminder = Show Reminder

View file

@ -148,14 +148,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
ignoreRevlogsBeforeMs: getIgnoreRevlogsBeforeMs(),
currentParams: params,
});
if (
const already_optimal =
(params.length &&
params.every(
(n, i) => n.toFixed(4) === resp.params[i].toFixed(4),
)) ||
resp.params.length === 0
) {
setTimeout(() => alert(tr.deckConfigFsrsParamsOptimal()), 200);
resp.params.length === 0;
if (already_optimal) {
const msg = resp.fsrsItems
? tr.deckConfigFsrsParamsOptimal()
: tr.deckConfigFsrsParamsNoReviews();
setTimeout(() => alert(msg), 200);
} else {
$config.fsrsParams5 = resp.params;
}