mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
Attempting to fix the Paid Mix empty state for Tiers
refs: https://github.com/TryGhost/Team/issues/1531
This commit is contained in:
parent
f4df91aee7
commit
d2f356e2a4
@ -250,6 +250,9 @@ export default class PaidMix extends Component {
|
||||
}
|
||||
|
||||
get areTiersAllZero() {
|
||||
if (this.dashboardStats.paidMembersByTier === null || this.dashboardStats.paidMembersByTier.length === 0) {
|
||||
return true;
|
||||
}
|
||||
const data = this.dashboardStats.paidMembersByTier.map(stat => stat.members);
|
||||
let areAllTiersZero = true;
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
@ -329,13 +332,19 @@ export default class PaidMix extends Component {
|
||||
|
||||
// tiers all have 0 data
|
||||
if (this.areTiersAllZero) {
|
||||
let equalPercentageData = Math.round(100 / data.length);
|
||||
|
||||
totalTiersAmount = 100;
|
||||
if (data.length > 0) {
|
||||
let equalPercentageData = Math.round(100 / data.length);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
data[i] = equalPercentageData;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
labels[0] = "Tier 1";
|
||||
labels[1] = "Tier 2";
|
||||
data[0] = 50;
|
||||
data[1] = 50;
|
||||
}
|
||||
// tiers have good data
|
||||
} else {
|
||||
totalTiersAmount = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user