mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
handle error of evaluation if items.is_empty()
This commit is contained in:
parent
e269983150
commit
7f0a5570e7
2 changed files with 5 additions and 0 deletions
|
@ -162,6 +162,9 @@ impl Collection {
|
|||
.get_revlog_entries_for_searched_cards_in_card_order()?;
|
||||
let (items, review_count) =
|
||||
fsrs_items_for_training(revlogs, timing.next_day_at, ignore_revlogs_before);
|
||||
if items.is_empty() {
|
||||
return Err(AnkiError::FsrsInsufficientData);
|
||||
}
|
||||
anki_progress.state.reviews = review_count as u32;
|
||||
let fsrs = FSRS::new(Some(weights))?;
|
||||
Ok(fsrs.evaluate(items, |ip| {
|
||||
|
|
|
@ -185,6 +185,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
}
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
alert(tr.deckConfigNotEnoughHistory());
|
||||
} finally {
|
||||
checkingWeights = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue