fixed alot of bugs in overview

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-28 22:09:44 +01:00
parent 93cf5dbc0a
commit 5bfe0b9e35
12 changed files with 71 additions and 35 deletions

View File

@@ -76,6 +76,10 @@ export function getChartSql({
sb.select.count = `countDistinct(profile_id) as count`;
}
if (event.segment === 'session') {
sb.select.count = `countDistinct(session_id) as count`;
}
if (event.segment === 'user_average') {
sb.select.count = `COUNT(*)::float / COUNT(DISTINCT profile_id)::float as count`;
}

View File

@@ -5,10 +5,11 @@ export type IServiceDashboards = Awaited<
ReturnType<typeof getDashboardsByProjectId>
>;
export async function getDashboardById(id: string) {
export async function getDashboardById(id: string, projectId: string) {
const dashboard = await db.dashboard.findUnique({
where: {
id,
project_id: projectId,
},
include: {
project: true,