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!

hotfix

Blue Mouse421ab822feb3
diff --git a/apps/production/src/project/project.controller.ts b/apps/production/src/project/project.controller.ts
index 1f0ad52d2..99d3c2897 100644
--- a/apps/production/src/project/project.controller.ts
+++ b/apps/production/src/project/project.controller.ts
@@ -167,10 +167,16 @@ export class ProjectController {
this.userService.findOne(userId),
])
+ const pidsWithData =
+ await this.projectService.getPIDsWhereAnalyticsDataExists(
+ _map(paginated.results, ({ id }) => id),
+ )
+
paginated.results = _map(paginated.results, p => ({
...p,
isOwner: true,
isLocked: !!user?.dashboardBlockReason,
+ isDataExists: _includes(pidsWithData, p?.id),
}))
return {
diff --git a/apps/selfhosted/src/project/project.controller.ts b/apps/selfhosted/src/project/project.controller.ts
index 26b418b2b..4c0ff4cb7 100644
--- a/apps/selfhosted/src/project/project.controller.ts
+++ b/apps/selfhosted/src/project/project.controller.ts
@@ -19,6 +19,7 @@ import * as _trim from 'lodash/trim'
import * as _size from 'lodash/size'
import * as _split from 'lodash/split'
import * as _head from 'lodash/head'
+import * as _includes from 'lodash/includes'
import * as dayjs from 'dayjs'
import { JwtAccessTokenGuard } from '../auth/guards'
@@ -67,10 +68,23 @@ export class ProjectController {
): Promise<Pagination<Project> | Project[] | object> {
this.logger.log({ userId, take, skip }, 'GET /project')
- const results = await getProjectsClickhouse()
- const formatted = _map(results, this.projectService.formatFromClickhouse)
+ const chResults = await getProjectsClickhouse()
+ const formatted = _map(chResults, this.projectService.formatFromClickhouse)
+
+ const pidsWithData =
+ await this.projectService.getPIDsWhereAnalyticsDataExists(
+ _map(formatted, ({ id }) => id),
+ )
+
+ const results = _map(formatted, p => ({
+ ...p,
+ isOwner: true,
+ isLocked: false,
+ isDataExists: _includes(pidsWithData, p?.id),
+ }))
+
return {
- results: formatted,
+ results,
page_total: _size(formatted),
total: _size(formatted),
totalMonthlyEvents: 0, // not needed as it's selfhosed