mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
alert when the resp.weights is empty (#3061)
* alert when the resp.weights is empty * format
This commit is contained in:
parent
6ac60f8032
commit
f2acf40221
3 changed files with 8 additions and 9 deletions
|
@ -346,10 +346,8 @@ impl Collection {
|
||||||
&config.inner.fsrs_weights,
|
&config.inner.fsrs_weights,
|
||||||
) {
|
) {
|
||||||
Ok(weights) => {
|
Ok(weights) => {
|
||||||
if weights.fsrs_items >= 1000 {
|
println!("{}: {:?}", config.name, weights.weights);
|
||||||
println!("{}: {:?}", config.name, weights.weights);
|
config.inner.fsrs_weights = weights.weights;
|
||||||
config.inner.fsrs_weights = weights.weights;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Err(AnkiError::Interrupted) => return Err(AnkiError::Interrupted),
|
Err(AnkiError::Interrupted) => return Err(AnkiError::Interrupted),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -96,7 +96,7 @@ impl Collection {
|
||||||
let mut weights =
|
let mut weights =
|
||||||
fsrs.compute_parameters(items.clone(), fsrs_items < 1000, Some(progress2))?;
|
fsrs.compute_parameters(items.clone(), fsrs_items < 1000, Some(progress2))?;
|
||||||
let metrics = fsrs.universal_metrics(items, &weights, |_| true)?;
|
let metrics = fsrs.universal_metrics(items, &weights, |_| true)?;
|
||||||
if metrics.0 < metrics.1 {
|
if metrics.0 <= metrics.1 {
|
||||||
weights = current_weights.to_vec();
|
weights = current_weights.to_vec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,10 +117,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
currentWeights: $config.fsrsWeights,
|
currentWeights: $config.fsrsWeights,
|
||||||
});
|
});
|
||||||
if (
|
if (
|
||||||
$config.fsrsWeights.length &&
|
($config.fsrsWeights.length &&
|
||||||
$config.fsrsWeights.every(
|
$config.fsrsWeights.every(
|
||||||
(n, i) => n.toFixed(4) === resp.weights[i].toFixed(4),
|
(n, i) => n.toFixed(4) === resp.weights[i].toFixed(4),
|
||||||
)
|
)) ||
|
||||||
|
resp.weights.length === 0
|
||||||
) {
|
) {
|
||||||
alert(tr.deckConfigFsrsParamsOptimal());
|
alert(tr.deckConfigFsrsParamsOptimal());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue