Skip to content

Commit

Permalink
Also clear memory states when rescheduling using FSRS helper add-on i…
Browse files Browse the repository at this point in the history
…f item is None
  • Loading branch information
user1823 committed Jan 13, 2025
1 parent c7243d8 commit bbce788
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions rslib/src/scheduler/fsrs/memory_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,20 @@ impl Collection {
historical_retention,
ignore_revlogs_before_ms_from_config(&config)?,
)?;
card.set_memory_state(&fsrs, item, historical_retention)?;
Ok(ComputeMemoryStateResponse {
state: card.memory_state.map(Into::into),
desired_retention,
})
if item.is_some() {
card.set_memory_state(&fsrs, item, historical_retention)?;
Ok(ComputeMemoryStateResponse {
state: card.memory_state.map(Into::into),
desired_retention,
})
} else {
card.memory_state = None;
card.desired_retention = None;
Ok(ComputeMemoryStateResponse {
state: None,
desired_retention,
})
}
}
}

Expand Down

0 comments on commit bbce788

Please sign in to comment.