Compare commits

..

2 Commits

Author SHA1 Message Date
standardci
59fc4a089c chore(release): publish new version
- @standardnotes/analytics@2.17.5
2022-12-20 13:16:57 +00:00
Karol Sójko
ef26dc8cbb fix(analytics): accessing analytics in report 2022-12-20 14:13:54 +01:00
4 changed files with 9 additions and 12 deletions

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.17.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.17.4...@standardnotes/analytics@2.17.5) (2022-12-20)
### Bug Fixes
* **analytics:** accessing analytics in report ([ef26dc8](https://github.com/standardnotes/server/commit/ef26dc8cbb967e088ae7387ff6dbec1e60dc3ee4))
## [2.17.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.17.3...@standardnotes/analytics@2.17.4) (2022-12-20)
**Note:** Version bump only for package @standardnotes/analytics

View File

@@ -29,7 +29,6 @@ const requestReport = async (
calculateMonthlyRecurringRevenue: CalculateMonthlyRecurringRevenue,
timer: TimerInterface,
adminEmails: string[],
logger: Logger,
): Promise<void> => {
await calculateMonthlyRecurringRevenue.execute({})
@@ -134,7 +133,6 @@ const requestReport = async (
counts: await statisticsStore.calculateTotalCountOverPeriod(statisticName, Period.Last30DaysIncludingToday),
})
}
logger.info('Calculated thirty days statistics: %O', statisticsOverTime)
const monthlyStatisticsNames = [StatisticMeasureName.NAMES.MRR]
for (const statisticName of monthlyStatisticsNames) {
@@ -284,7 +282,6 @@ void container.load().then((container) => {
calculateMonthlyRecurringRevenue,
timer,
adminEmails,
logger,
),
)
.then(() => {

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.17.4",
"version": "2.17.5",
"engines": {
"node": ">=18.0.0 <19.0.0"
},

View File

@@ -6,24 +6,18 @@ import { StatisticMeasureName } from '../Statistics/StatisticMeasureName'
import { Period } from '../Time/Period'
const countActiveUsers = (measureName: string, data: any): { yesterday: number; last30Days: number } => {
const totalActiveUsersLast30DaysIncludingToday = data.statisticMeasures.find(
const totalActiveUsersLast30DaysIncludingToday = data.statisticsOverTime.find(
(a: { name: string; period: number }) => a.name === measureName && a.period === 27,
)
// eslint-disable-next-line no-console
console.log(totalActiveUsersLast30DaysIncludingToday)
const totalActiveUsersYesterday =
totalActiveUsersLast30DaysIncludingToday.counts[totalActiveUsersLast30DaysIncludingToday.counts.length - 2]
.totalCount
// eslint-disable-next-line no-console
console.log(totalActiveUsersYesterday)
const filteredCounts = totalActiveUsersLast30DaysIncludingToday.counts.filter(
(count: { totalCount: number }) => count.totalCount !== 0,
)
// eslint-disable-next-line no-console
console.log(filteredCounts)
const averageActiveUsersLast30Days = Math.floor(
filteredCounts.reduce((previousValue: { totalCount: any }, currentValue: { totalCount: any }) => {
return previousValue.totalCount + currentValue.totalCount