return current weights if fsrs_items is zero

This commit is contained in:
Jarrett Ye 2024-04-14 17:08:01 +08:00
parent a1fa865bb2
commit e269983150
No known key found for this signature in database
GPG key ID: EBFC55E0C1A352BB

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;