Exclude new cards from Future Due stats (#3576)

* Exclude new cards from Future Due stats

https://github.com/ankitects/anki/pull/3530#issuecomment-2439924619

Before 7ea573b004, they were excluded anyway.

* Update future_due.rs

* Update comment

* Minor simplification
This commit is contained in:
user1823 2024-11-17 20:49:27 +05:30 committed by GitHub
parent 2cbb648456
commit db1280e6ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,7 +16,11 @@ impl GraphsContext {
let mut due_by_day: HashMap<i32, u32> = Default::default(); let mut due_by_day: HashMap<i32, u32> = Default::default();
let mut daily_load = 0.0; let mut daily_load = 0.0;
for c in &self.cards { for c in &self.cards {
if matches!(c.queue, CardQueue::New | CardQueue::Suspended) { // matched on type because queue changes on burying or suspending a new card
if c.ctype == CardType::New {
continue;
}
if c.queue == CardQueue::Suspended {
continue; continue;
} }
let due = c.original_or_current_due(); let due = c.original_or_current_due();
@ -27,9 +31,7 @@ impl GraphsContext {
due - (self.days_elapsed as i32) due - (self.days_elapsed as i32)
}; };
if c.ctype != CardType::New { daily_load += 1.0 / c.interval.max(1) as f32;
daily_load += 1.0 / c.interval.max(1) as f32;
}
// still want to filtered out buried cards that are due today // still want to filtered out buried cards that are due today
if due_day <= 0 && matches!(c.queue, CardQueue::UserBuried | CardQueue::SchedBuried) { if due_day <= 0 && matches!(c.queue, CardQueue::UserBuried | CardQueue::SchedBuried) {