diff --git a/rslib/src/stats/graphs/future_due.rs b/rslib/src/stats/graphs/future_due.rs index a98f2de5c..4f96bf8c8 100644 --- a/rslib/src/stats/graphs/future_due.rs +++ b/rslib/src/stats/graphs/future_due.rs @@ -32,7 +32,7 @@ impl GraphsContext { } // 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) { continue; } have_backlog |= due_day < 0; diff --git a/ts/routes/graphs/future-due.ts b/ts/routes/graphs/future-due.ts index 96a7bab7a..6100470b7 100644 --- a/ts/routes/graphs/future-due.ts +++ b/ts/routes/graphs/future-due.ts @@ -46,23 +46,33 @@ function makeQuery(start: number, end: number): string { } } +function withoutBacklog(data: Map): Map { + const map = new Map(); + for (const [day, count] of data.entries()) { + if (day >= 0) { + map.set(day, count); + } + } + return map; +} + export function buildHistogram( sourceData: GraphData, range: GraphRange, - backlog: boolean, + includeBacklog: boolean, dispatch: SearchDispatch, browserLinksSupported: boolean, ): FutureDueResponse { const output = { histogramData: null, tableData: [] }; // get min/max - const data = sourceData.dueCounts; + const data = includeBacklog ? sourceData.dueCounts : withoutBacklog(sourceData.dueCounts); if (!data) { return output; } const [xMinOrig, origXMax] = extent(data.keys()); let xMin = xMinOrig; - if (!backlog) { + if (!includeBacklog) { xMin = 0; } let xMax = origXMax;