mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🐛 Fixed incorrect member count on dashboard
closes https://github.com/TryGhost/Team/issues/561 In case the last event for a new member on site was before 30 day period, the count for members was showing 0 instead of the actual value. The change fixes the count to show the correct value even if there is no new recent member activity.
This commit is contained in:
parent
43c83c77f2
commit
803523c31d
1 changed files with 4 additions and 1 deletions
|
@ -112,7 +112,10 @@ export default class MembersStatsService extends Service {
|
|||
const firstDateInRangeIndex = data.findIndex((val) => {
|
||||
return moment(val.date).isAfter(currentRangeDate);
|
||||
});
|
||||
const initialDateInRangeVal = firstDateInRangeIndex > 0 ? data[firstDateInRangeIndex - 1] : null;
|
||||
let initialDateInRangeVal = firstDateInRangeIndex > 0 ? data[firstDateInRangeIndex - 1] : null;
|
||||
if (data.length > 0 && !initialDateInRangeVal && firstDateInRangeIndex !== 0) {
|
||||
initialDateInRangeVal = data[data.length - 1];
|
||||
}
|
||||
let lastVal = {
|
||||
paid: initialDateInRangeVal ? initialDateInRangeVal.paid : 0,
|
||||
free: initialDateInRangeVal ? initialDateInRangeVal.free : 0,
|
||||
|
|
Loading…
Add table
Reference in a new issue