mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
include backlog cards in today in future due graph (#3379)
* include backlog cards in today in future due graph when backlog option is not checked * Don't add the backlog to today when backlog disabled --------- Co-authored-by: Damien Elmes <gpg@ankiweb.net>
This commit is contained in:
parent
b4ae7ce907
commit
487b38b06c
2 changed files with 14 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue