Fix one-off error for Histograms:

examples:
* x0 = -66 and x1 = -64 should yield 65-66 days ago instead of 64-65 days ago
* x0 = -2 and x1 = 0 should yield 1-2 days ago instead of 0-1 days ago
This commit is contained in:
Henrik Giesel 2021-01-07 17:14:31 +01:00
parent 2d22b09cd8
commit 7b14449df4
2 changed files with 2 additions and 3 deletions

View file

@ -42,7 +42,6 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData {
if (isLearning(c)) {
const offset = c.due - data.nextDayAtSecs
dueDay = Math.floor(offset / 86_400) + 1;
} else {
// - testing just odue fails on day 1
// - testing just odid fails on lapsed cards that

View file

@ -151,8 +151,8 @@ export function dayLabel(i18n: I18n, daysStart: number, daysEnd: number): string
});
} else {
return i18n.tr(i18n.TR.STATISTICS_DAYS_AGO_RANGE, {
daysStart: Math.abs(daysEnd),
daysEnd: -daysStart - 1,
daysStart: Math.abs(daysEnd - 1),
daysEnd: -daysStart,
});
}
}