Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fixed chart not updating on filters

Blue Mouseba777664e9da
diff --git a/src/analytics/analytics.controller.ts b/src/analytics/analytics.controller.ts
index 66d5d1730..4c6ccef5b 100644
--- a/src/analytics/analytics.controller.ts
+++ b/src/analytics/analytics.controller.ts
@@ -118,7 +118,7 @@ export class AnalyticsController {
throw new BadRequestException('The timeframe (either from/to pair or period) to be provided')
}
- const result = await this.analyticsService.groupByTimeBucket(timeBucket, groupFrom, groupTo, subQuery, pid)
+ const result = await this.analyticsService.groupByTimeBucket(timeBucket, groupFrom, groupTo, subQuery, pid, filtersQuery)
const customs = await this.analyticsService.processCustomEV(queryCustoms)
diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.ts
index 0a5927168..549811b6e 100644
--- a/src/analytics/analytics.service.ts
+++ b/src/analytics/analytics.service.ts
@@ -330,7 +330,7 @@ export class AnalyticsService {
return result
}
- async groupByTimeBucket(timeBucket: TimeBucketType, from: string, to: string, subQuery: string, pid: string): Promise<object | void> {
+ async groupByTimeBucket(timeBucket: TimeBucketType, from: string, to: string, subQuery: string, pid: string, filtersQuery: string): Promise<object | void> {
const params = {}
for (let i of cols) {
@@ -392,7 +392,7 @@ export class AnalyticsService {
query += ' UNION ALL '
}
- query += `select ${i} index, unique, count() from analytics where pid='${pid}' and created between '${xM[i]}' and '${xM[1 + i]}' group by unique`
+ query += `select ${i} index, unique, count() from analytics where pid='${pid}' and created between '${xM[i]}' and '${xM[1 + i]}' ${filtersQuery} group by unique`
}
// @ts-ignore