Return current weights if fsrs items is zero & handle error in evaluation and optimal retention (#3141)

* return current weights if fsrs_items is zero

* handle error of evaluation if items.is_empty()

* TODO: handle error of optimal retention

* Revert "TODO: handle error of optimal retention"

This reverts commit 80a5b3803e.

* Revert "handle error of evaluation if items.is_empty()"

This reverts commit 7f0a5570e7.
This commit is contained in:
Jarrett Ye 2024-04-17 18:18:00 +08:00 committed by GitHub
parent e66adcca38
commit d1b2ab5983
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,6 +65,12 @@ impl Collection {
fsrs_items_for_training(revlogs.clone(), timing.next_day_at, ignore_revlogs_before); fsrs_items_for_training(revlogs.clone(), timing.next_day_at, ignore_revlogs_before);
let fsrs_items = items.len() as u32; let fsrs_items = items.len() as u32;
if fsrs_items == 0 {
return Ok(ComputeFsrsWeightsResponse {
weights: current_weights.to_vec(),
fsrs_items,
});
}
anki_progress.update(false, |p| { anki_progress.update(false, |p| {
p.current_preset = current_preset; p.current_preset = current_preset;
p.total_presets = total_presets; p.total_presets = total_presets;