fix(dashboard): broken funnels on profile_id

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-04-02 11:21:51 +02:00
parent a6762b90ca
commit c5d25779c6

View File

@@ -16,7 +16,7 @@ export class FunnelService {
private getFunnelGroup(group?: string) { private getFunnelGroup(group?: string) {
return group === 'profile_id' return group === 'profile_id'
? [`COALESCE(nullIf(s.profile_id, ''), e.profile_id)`, 'profile_id'] ? [`COALESCE(nullIf(s.profile_id, ''), profile_id)`, 'profile_id']
: ['session_id', 'session_id']; : ['session_id', 'session_id'];
} }
@@ -155,12 +155,15 @@ export class FunnelService {
: null; : null;
// Base funnel query with CTEs // Base funnel query with CTEs
const funnelQuery = clix(this.client).with('funnel', funnelCte); const funnelQuery = clix(this.client);
if (sessionsCte) { if (sessionsCte) {
funnelCte.join('sessions s', 's.id = session_id');
funnelQuery.with('sessions', sessionsCte); funnelQuery.with('sessions', sessionsCte);
} }
funnelQuery.with('funnel', funnelCte);
funnelQuery funnelQuery
.select<{ .select<{
level: number; level: number;