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

Skip to content
Merged
Changes from 4 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
17 changes: 15 additions & 2 deletions rslib/src/scheduler/fsrs/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,21 @@ impl Collection {
.col
.storage
.get_revlog_entries_for_searched_cards_in_card_order()?;
let cards = guard.col.storage.all_searched_cards()?;
let mut cards = guard.col.storage.all_searched_cards()?;
drop(guard);
fn is_included_card(c: &Card) -> bool {
c.queue != CardQueue::Suspended
&& c.queue != CardQueue::PreviewRepeat
&& c.queue != CardQueue::New
}
for c in &mut cards {
if is_included_card(c) && c.memory_state.is_none() {
let original = c.clone();
let new_state = self.compute_memory_state(c.id)?.state;
c.memory_state = new_state.map(Into::into);
self.update_card_inner(c, original, self.usn()?)?;
}
}
let days_elapsed = self.timing_today().unwrap().days_elapsed as i32;
let new_cards = cards
.iter()
Expand All @@ -133,7 +146,7 @@ impl Collection {
+ req.deck_size as usize;
let mut converted_cards = cards
.into_iter()
.filter(|c| c.queue != CardQueue::Suspended && c.queue != CardQueue::PreviewRepeat)
.filter(is_included_card)
.filter_map(|c| Card::convert(c, days_elapsed))
.collect_vec();
let introduced_today_count = self
Expand Down