mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Breakdown report.
This commit is contained in:
parent
79ea9974b7
commit
e3cc19638c
21 changed files with 495 additions and 456 deletions
|
|
@ -16,7 +16,7 @@ export * from '@/queries/sql/events/saveEvent';
|
|||
export * from '@/queries/sql/reports/getFunnel';
|
||||
export * from '@/queries/sql/reports/getJourney';
|
||||
export * from '@/queries/sql/reports/getRetention';
|
||||
export * from '@/queries/sql/reports/getInsights';
|
||||
export * from '@/queries/sql/reports/getBreakdown';
|
||||
export * from '@/queries/sql/reports/getUTM';
|
||||
export * from '@/queries/sql/pageviews/getPageviewMetrics';
|
||||
export * from '@/queries/sql/pageviews/getPageviewStats';
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import clickhouse from '@/lib/clickhouse';
|
|||
import { EVENT_TYPE, FILTER_COLUMNS, SESSION_COLUMNS } from '@/lib/constants';
|
||||
import { QueryFilters } from '@/lib/types';
|
||||
|
||||
export async function getInsights(
|
||||
...args: [websiteId: string, fields: { name: string; type?: string }[], filters: QueryFilters]
|
||||
export async function getBreakdown(
|
||||
...args: [websiteId: string, fields: string[], filters: QueryFilters]
|
||||
) {
|
||||
return runQuery({
|
||||
[PRISMA]: () => relationalQuery(...args),
|
||||
|
|
@ -15,7 +15,7 @@ export async function getInsights(
|
|||
|
||||
async function relationalQuery(
|
||||
websiteId: string,
|
||||
fields: { name: string; type?: string }[],
|
||||
fields: string[],
|
||||
filters: QueryFilters,
|
||||
): Promise<
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ async function relationalQuery(
|
|||
eventType: EVENT_TYPE.pageView,
|
||||
},
|
||||
{
|
||||
joinSession: !!fields.find(({ name }) => SESSION_COLUMNS.includes(name)),
|
||||
joinSession: !!fields.find(name => SESSION_COLUMNS.includes(name)),
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ async function relationalQuery(
|
|||
|
||||
async function clickhouseQuery(
|
||||
websiteId: string,
|
||||
fields: { name: string; type?: string }[],
|
||||
fields: string[],
|
||||
filters: QueryFilters,
|
||||
): Promise<
|
||||
{
|
||||
|
|
@ -118,10 +118,10 @@ async function clickhouseQuery(
|
|||
);
|
||||
}
|
||||
|
||||
function parseFields(fields: { name: any }[]) {
|
||||
return fields.map(({ name }) => `${FILTER_COLUMNS[name]} as "${name}"`).join(',');
|
||||
function parseFields(fields: string[]) {
|
||||
return fields.map(name => `${FILTER_COLUMNS[name]} as "${name}"`).join(',');
|
||||
}
|
||||
|
||||
function parseFieldsByName(fields: { name: any }[]) {
|
||||
return `${fields.map(({ name }) => name).join(',')}`;
|
||||
function parseFieldsByName(fields: string[]) {
|
||||
return `${fields.map(name => name).join(',')}`;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue