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 80a5b3803ef4b8270d13aabb9a832291b55d4847.

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

This reverts commit 7f0a5570e74ba5236fc02942550b4e00046b71bc.
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);
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| {
p.current_preset = current_preset;
p.total_presets = total_presets;