Fix future due search missing cards on last day (#3206)

This commit is contained in:
Abdo 2024-05-24 12:46:38 +03:00 committed by GitHub
parent a9bf702317
commit abacdcaeda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,7 +103,7 @@ export function buildHistogram(
cumulative: number,
_percent: number,
): string {
const days = dayLabel(bin.x0!, bin.x1!);
const days = dayLabel(bin.x0!, bin.x1 === xMax ? bin.x1! + 1 : bin.x1!);
const cards = tr.statisticsCardsDue({
cards: getNumericMapBinValue(bin as any),
});
@ -114,7 +114,8 @@ export function buildHistogram(
function onClick(bin: Bin<number, number>): void {
const start = bin.x0!;
const end = bin.x1! - 1;
// x1 in last bin is inclusive
const end = bin.x1 === xMax ? bin.x1! : bin.x1! - 1;
const query = makeQuery(start, end);
dispatch("search", { query });
}