mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Synced the start date of members and MRR 'all time' charts (dashboard 5.0)
no issue - When using 'all time' in the past, the start date of the total members/paid members chart would differ from the MRR chart. They are now synced. - The start date is always the earliest date we have data for (MRR or member counts) - The all time chart is minimum 90 days long
This commit is contained in:
parent
b3bb12a4ce
commit
7b12785c30
1 changed files with 17 additions and 1 deletions
|
@ -613,7 +613,23 @@ export default class DashboardStatsService extends Service {
|
|||
let currentRangeDate;
|
||||
|
||||
if (days === 'all') {
|
||||
currentRangeDate = data.length > 0 ? moment(data[0].date) : moment();
|
||||
const MINIMUM_DAYS = 90;
|
||||
currentRangeDate = moment().subtract(MINIMUM_DAYS - 1, 'days');
|
||||
|
||||
// Make sure all charts are synced correctly and have the same start date when choosing 'all time'
|
||||
if (this.mrrStats !== null && this.mrrStats.length > 0) {
|
||||
const date = moment(this.mrrStats[0].date);
|
||||
if (date.toDate() < currentRangeDate.toDate()) {
|
||||
currentRangeDate = date;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.memberCountStats !== null && this.memberCountStats.length > 0) {
|
||||
const date = moment(this.memberCountStats[0].date);
|
||||
if (date.toDate() < currentRangeDate.toDate()) {
|
||||
currentRangeDate = date;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
currentRangeDate = moment().subtract(days - 1, 'days');
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue