fix(analytics): add persisting mrr for this month and this year as well
This commit is contained in:
parent
37a5cb347d
commit
8df0482eb4
2 changed files with 10 additions and 2 deletions
|
@ -24,6 +24,10 @@ describe('CalculateMonthlyRecurringRevenue', () => {
|
|||
it('should calculate the MRR diff and persist it as a statistic', async () => {
|
||||
await createUseCase().execute({})
|
||||
|
||||
expect(statisticsStore.setMeasure).toHaveBeenCalledWith(StatisticsMeasure.MRR, 123.45, [Period.Today])
|
||||
expect(statisticsStore.setMeasure).toHaveBeenCalledWith(StatisticsMeasure.MRR, 123.45, [
|
||||
Period.Today,
|
||||
Period.ThisMonth,
|
||||
Period.ThisYear,
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -20,7 +20,11 @@ export class CalculateMonthlyRecurringRevenue implements DomainUseCaseInterface<
|
|||
async execute(_dto: CalculateMonthlyRecurringRevenueDTO): Promise<Result<MonthlyRevenue>> {
|
||||
const mrrDiff = await this.revenueModificationRepository.sumMRRDiff()
|
||||
|
||||
await this.statisticsStore.setMeasure(StatisticsMeasure.MRR, mrrDiff, [Period.Today])
|
||||
await this.statisticsStore.setMeasure(StatisticsMeasure.MRR, mrrDiff, [
|
||||
Period.Today,
|
||||
Period.ThisMonth,
|
||||
Period.ThisYear,
|
||||
])
|
||||
|
||||
return MonthlyRevenue.create(mrrDiff)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue