mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Feat/Show health check and already optimal at the same time (#4238)
This commit is contained in:
parent
f7974568c9
commit
b76918a217
1 changed files with 18 additions and 13 deletions
|
@ -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()),
|
let alreadyOptimalMessage = "";
|
||||||
200,
|
if (alreadyOptimal) {
|
||||||
);
|
alreadyOptimalMessage = resp.fsrsItems
|
||||||
}
|
|
||||||
} else if (already_optimal) {
|
|
||||||
const msg = 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;
|
||||||
|
|
Loading…
Reference in a new issue