Feat/Show health check and already optimal at the same time (#4238)

This commit is contained in:
Luc Mcgrady 2025-08-04 07:00:02 +01:00 committed by GitHub
parent f7974568c9
commit b76918a217
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -218,29 +218,34 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
healthCheck: $healthCheck, healthCheck: $healthCheck,
}); });
const already_optimal = const alreadyOptimal =
(params.length && (params.length &&
params.every( params.every(
(n, i) => n.toFixed(4) === resp.params[i].toFixed(4), (n, i) => n.toFixed(4) === resp.params[i].toFixed(4),
)) || )) ||
resp.params.length === 0; resp.params.length === 0;
let healthCheckMessage = "";
if (resp.healthCheckPassed !== undefined) { if (resp.healthCheckPassed !== undefined) {
if (resp.healthCheckPassed) { healthCheckMessage = resp.healthCheckPassed
setTimeout(() => alert(tr.deckConfigFsrsGoodFit()), 200); ? tr.deckConfigFsrsGoodFit()
} else { : tr.deckConfigFsrsBadFitWarning();
setTimeout(
() => alert(tr.deckConfigFsrsBadFitWarning()),
200,
);
} }
} else if (already_optimal) { let alreadyOptimalMessage = "";
const msg = resp.fsrsItems if (alreadyOptimal) {
alreadyOptimalMessage = resp.fsrsItems
? tr.deckConfigFsrsParamsOptimal() ? tr.deckConfigFsrsParamsOptimal()
: tr.deckConfigFsrsParamsNoReviews(); : tr.deckConfigFsrsParamsNoReviews();
setTimeout(() => alert(msg), 200);
} }
if (!already_optimal) { const message = [alreadyOptimalMessage, healthCheckMessage]
.filter((a) => a)
.join("\n\n");
if (message) {
setTimeout(() => alert(message), 200);
}
if (!alreadyOptimal) {
$config.fsrsParams6 = resp.params; $config.fsrsParams6 = resp.params;
setTimeout(() => { setTimeout(() => {
optimized = true; optimized = true;