Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Set Due Date: Set interval to actual elapsed days when FSRS is enabled
  • Loading branch information
L-M-Sherlock committed May 26, 2025
commit eb4fcc0bc1ab13c104449d5d7b292004d5df0ef9
14 changes: 8 additions & 6 deletions rslib/src/scheduler/reviews.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ impl Card {
force_reset: bool,
) {
let new_due = (today + days_from_today) as i32;
let new_interval =
if force_reset || !matches!(self.ctype, CardType::Review | CardType::Relearn) {
days_from_today
} else {
self.interval
};
let fsrs_enabled = self.memory_state.is_some();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work if the card lacks memory states because it has been moved between decks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but I have not other good solution to know whether this card is scheduled by FSRS without looking at the collection global setting.

let new_interval = if fsrs_enabled {
self.interval.saturating_add_signed(new_due - self.due)
} else if force_reset || !matches!(self.ctype, CardType::Review | CardType::Relearn) {
days_from_today
} else {
self.interval
};
let ease_factor = (ease_factor * 1000.0).round() as u16;

self.schedule_as_review(new_interval, new_due, ease_factor);
Expand Down