Fixed tiers without members not shown in paid mix chart

This commit is contained in:
Simon Backx 2022-05-18 14:17:59 +02:00
parent 59a1b8a31f
commit 6ba9f6a3be

View File

@ -366,6 +366,7 @@ export default class DashboardStatsService extends Service {
const _tier = this.paidTiers.find(x => x.id === tier);
paidMembersByTier.push({
tier: {
id: _tier.id,
name: _tier.name
},
members: result.meta.totals.reduce((sum, total) => {
@ -377,6 +378,19 @@ export default class DashboardStatsService extends Service {
});
}
// Add all missing tiers without members
for (const tier of this.paidTiers) {
if (!paidMembersByTier.find(t => t.tier.id === tier.id)) {
paidMembersByTier.push({
tier: {
id: tier.id,
name: tier.name
},
members: 0
});
}
}
function mergeDates(list, entry) {
const [current, ...rest] = list;