From 1c297a23dfd573b79ab33ca6633f990457a39c3b Mon Sep 17 00:00:00 2001 From: user1823 <92206575+user1823@users.noreply.github.com> Date: Sun, 17 Nov 2024 20:49:27 +0530 Subject: [PATCH] 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 https://github.com/ankitects/anki/commit/666e75622a0e4445fc96a7479fa23bba7fb8c9cb, they were excluded anyway. * Update future_due.rs * Update comment * Minor simplification --- rslib/src/stats/graphs/future_due.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rslib/src/stats/graphs/future_due.rs b/rslib/src/stats/graphs/future_due.rs index 4f96bf8c8..6a00a07f1 100644 --- a/rslib/src/stats/graphs/future_due.rs +++ b/rslib/src/stats/graphs/future_due.rs @@ -16,7 +16,11 @@ impl GraphsContext { let mut due_by_day: HashMap = Default::default(); let mut daily_load = 0.0; 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; } let due = c.original_or_current_due(); @@ -27,9 +31,7 @@ impl GraphsContext { 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 if due_day <= 0 && matches!(c.queue, CardQueue::UserBuried | CardQueue::SchedBuried) {