mirror of
https://github.com/flarum/core.git
synced 2025-08-01 14:10:37 +02:00
[statistics] fix: add missing last period to custom date ranges (#3661)
* fix: last node in previous data matches first node of current data * fix: add previous period support for custom periods * test: update to show previous period for custom range
This commit is contained in:
@@ -348,7 +348,7 @@ export default class StatisticsWidget extends DashboardWidget {
|
||||
}
|
||||
: this.periods![this.selectedPeriod!];
|
||||
const periodLength = period.end - period.start;
|
||||
const labels = [];
|
||||
const labels: string[] = [];
|
||||
const thisPeriod = [];
|
||||
const lastPeriod = [];
|
||||
|
||||
@@ -373,7 +373,7 @@ export default class StatisticsWidget extends DashboardWidget {
|
||||
labels.push(label);
|
||||
|
||||
thisPeriod.push(this.getPeriodCount(this.selectedEntity, { start: i, end: i + period.step }));
|
||||
lastPeriod.push(this.getPeriodCount(this.selectedEntity, { start: i - periodLength, end: i - periodLength + period.step }));
|
||||
lastPeriod.push(this.getPeriodCount(this.selectedEntity, { start: i - periodLength, end: i - periodLength }));
|
||||
}
|
||||
|
||||
if (thisPeriod.length === 0) {
|
||||
|
Reference in New Issue
Block a user