diff --git a/ts/src/stats/FutureDue.svelte b/ts/src/stats/FutureDue.svelte
index 9817e59c7..a0773e1c2 100644
--- a/ts/src/stats/FutureDue.svelte
+++ b/ts/src/stats/FutureDue.svelte
@@ -14,6 +14,7 @@
let graphData = null as GraphData | null;
let histogramData = null as HistogramData | null;
let tableData: TableDatum[] = [] as any;
+ let haveBacklog: boolean = false;
let backlog: boolean = true;
let graphRange: GraphRange = GraphRange.Month;
@@ -22,12 +23,12 @@
}
$: if (graphData) {
- [histogramData, tableData] = buildHistogram(
+ ({ histogramData, tableData } = buildHistogram(
graphData,
graphRange,
backlog,
i18n
- );
+ ));
}
const title = i18n.tr(i18n.TR.STATISTICS_FUTURE_DUE_TITLE);
@@ -41,10 +42,12 @@
{subtitle}
-
+ {#if graphData && graphData.haveBacklog}
+
+ {/if}
diff --git a/ts/src/stats/future-due.ts b/ts/src/stats/future-due.ts
index abc16e2b1..13d6a46bc 100644
--- a/ts/src/stats/future-due.ts
+++ b/ts/src/stats/future-due.ts
@@ -18,11 +18,13 @@ import { GraphRange, TableDatum } from "./graphs";
export interface GraphData {
dueCounts: Map;
+ haveBacklog: boolean;
}
export function gatherData(data: pb.BackendProto.GraphsOut): GraphData {
const isLearning = (queue: number): boolean =>
[CardQueue.Learn, CardQueue.PreviewRepeat].includes(queue);
+ let haveBacklog = false;
const due = (data.cards as pb.BackendProto.Card[])
.filter(
(c) =>
@@ -39,7 +41,11 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData {
// - testing just odid fails on lapsed cards that
// have due calculated at regraduation time
const due = c.odid && c.odue ? c.odue : c.due;
- return due - data.daysElapsed;
+ const dueDay = due - data.daysElapsed;
+ if (dueDay < 0) {
+ haveBacklog = true;
+ }
+ return dueDay;
}
});
@@ -48,23 +54,29 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData {
(v) => v.length,
(d) => d
);
- return { dueCounts };
+ return { dueCounts, haveBacklog };
}
function binValue(d: Bin