()
| 820 | } |
| 821 | |
| 822 | updateAllKPIChartData () { |
| 823 | // Calculate daily mrr based on previous 30 days, attribute full year sub purchase to purchase day |
| 824 | // Do not include gem purchases |
| 825 | this.dayMrrMap = {} |
| 826 | if ((this.revenue != null ? this.revenue.length : undefined) > 0) { |
| 827 | const daysInMonth = 30 |
| 828 | let currentMrr = 0 |
| 829 | const currentMonthlyValues = [] |
| 830 | for (let start = this.revenue.length - 1, i = start, asc = start <= 0; asc ? i <= 0 : i >= 0; asc ? i++ : i--) { |
| 831 | if (i >= 0) { |
| 832 | const total = this.revenue[i].groups[this.revenueGroups.indexOf('DRR Total')] |
| 833 | currentMonthlyValues.push(total) |
| 834 | currentMrr += total |
| 835 | while (currentMonthlyValues.length > daysInMonth) { currentMrr -= currentMonthlyValues.shift() } |
| 836 | if (currentMonthlyValues.length === daysInMonth) { this.dayMrrMap[this.revenue[i].day] = currentMrr } |
| 837 | } |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | this.kpiRecentChartLines = [] |
| 842 | this.kpiChartLines = [] |
| 843 | this.kpiAllTimeChartLines = [] |
| 844 | this.updateKPIChartData(60, this.kpiRecentChartLines) |
| 845 | this.updateKPIChartData(365, this.kpiChartLines) |
| 846 | this.numAllDays = Math.round((new Date() - this.allTimeStartDate) / 1000 / 60 / 60 / 24) |
| 847 | return this.updateKPIChartData(this.numAllDays, this.kpiAllTimeChartLines) |
| 848 | } |
| 849 | |
| 850 | updateKPIChartData (timeframeDays, chartLines) { |
| 851 | let campaignData, count, data, day, days, entry, event, eventDayDataMap, pointRadius, points, value |
no test coverage detected