From 89c3af9e9ebe71af84c59530ef551964066b3fa4 Mon Sep 17 00:00:00 2001 From: user1823 <92206575+user1823@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:05:11 +0530 Subject: [PATCH 1/3] Exclude new cards from Future Due stats https://github.com/ankitects/anki/pull/3530#issuecomment-2439924619 Before https://github.com/ankitects/anki/commit/7ea573b004c976d20d95d706893993c1b6d79f74, they were excluded anyway. --- 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 4f96bf8c86..5101cc8bf6 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, not queue, because burying a new card changes the queue to buried + if matches!(c.ctype, CardType::New) { + continue; + } + if matches!(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) { From bc24f475842a0803494644dd426cdad1af29be37 Mon Sep 17 00:00:00 2001 From: user1823 <92206575+user1823@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:08:49 +0530 Subject: [PATCH 2/3] Update future_due.rs --- rslib/src/stats/graphs/future_due.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rslib/src/stats/graphs/future_due.rs b/rslib/src/stats/graphs/future_due.rs index 5101cc8bf6..b91d2f865e 100644 --- a/rslib/src/stats/graphs/future_due.rs +++ b/rslib/src/stats/graphs/future_due.rs @@ -16,7 +16,8 @@ impl GraphsContext { let mut due_by_day: HashMap = Default::default(); let mut daily_load = 0.0; for c in &self.cards { - // matched on type, not queue, because burying a new card changes the queue to buried + // matched on type, not queue, because burying a new card changes the queue to + // buried if matches!(c.ctype, CardType::New) { continue; } From 962f7b3d31818664786f814302ad079478444abc Mon Sep 17 00:00:00 2001 From: user1823 <92206575+user1823@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:26:09 +0530 Subject: [PATCH 3/3] Update comment --- rslib/src/stats/graphs/future_due.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rslib/src/stats/graphs/future_due.rs b/rslib/src/stats/graphs/future_due.rs index b91d2f865e..46d4212412 100644 --- a/rslib/src/stats/graphs/future_due.rs +++ b/rslib/src/stats/graphs/future_due.rs @@ -16,8 +16,7 @@ impl GraphsContext { let mut due_by_day: HashMap = Default::default(); let mut daily_load = 0.0; for c in &self.cards { - // matched on type, not queue, because burying a new card changes the queue to - // buried + // matched on type because queue changes on burying or suspending a new card if matches!(c.ctype, CardType::New) { continue; }