Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include backlog cards in today in future due graph #3379

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rslib/src/stats/graphs/future_due.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions ts/routes/graphs/future-due.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,33 @@ function makeQuery(start: number, end: number): string {
}
}

function withoutBacklog(data: Map<number, number>): Map<number, number> {
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<number>(data.keys());
let xMin = xMinOrig;
if (!backlog) {
if (!includeBacklog) {
xMin = 0;
}
let xMax = origXMax;
Expand Down