fix(analytics): add monthly mrr to the report
This commit is contained in:
parent
92ba682198
commit
fce47a0a37
2 changed files with 19 additions and 3 deletions
|
@ -100,8 +100,6 @@ const requestReport = async (
|
|||
})
|
||||
}
|
||||
|
||||
const thirtyDaysStatisticsNames = [StatisticsMeasure.MRR]
|
||||
|
||||
const statisticsOverTime: Array<{
|
||||
name: string
|
||||
period: number
|
||||
|
@ -110,6 +108,8 @@ const requestReport = async (
|
|||
totalCount: number
|
||||
}>
|
||||
}> = []
|
||||
|
||||
const thirtyDaysStatisticsNames = [StatisticsMeasure.MRR]
|
||||
for (const statisticName of thirtyDaysStatisticsNames) {
|
||||
statisticsOverTime.push({
|
||||
name: statisticName,
|
||||
|
@ -118,6 +118,15 @@ const requestReport = async (
|
|||
})
|
||||
}
|
||||
|
||||
const monthlyStatisticsNames = [StatisticsMeasure.MRR]
|
||||
for (const statisticName of monthlyStatisticsNames) {
|
||||
statisticsOverTime.push({
|
||||
name: statisticName,
|
||||
period: Period.ThisYear,
|
||||
counts: await statisticsStore.calculateTotalCountOverPeriod(statisticName, Period.ThisYear),
|
||||
})
|
||||
}
|
||||
|
||||
const statisticMeasureNames = [
|
||||
StatisticsMeasure.Income,
|
||||
StatisticsMeasure.PlusSubscriptionInitialAnnualPaymentsIncome,
|
||||
|
|
|
@ -14,7 +14,14 @@ export class RedisStatisticsStore implements StatisticsStoreInterface {
|
|||
period: Period,
|
||||
): Promise<{ periodKey: string; totalCount: number }[]> {
|
||||
if (
|
||||
![Period.Last30Days, Period.Q1ThisYear, Period.Q2ThisYear, Period.Q3ThisYear, Period.Q4ThisYear].includes(period)
|
||||
![
|
||||
Period.Last30Days,
|
||||
Period.ThisYear,
|
||||
Period.Q1ThisYear,
|
||||
Period.Q2ThisYear,
|
||||
Period.Q3ThisYear,
|
||||
Period.Q4ThisYear,
|
||||
].includes(period)
|
||||
) {
|
||||
throw new Error(`Unsuporrted period: ${period}`)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue