Skip to content

Commit

Permalink
fix event data, remove field implementation for now
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscao633 committed Jul 31, 2023
1 parent 7e112b8 commit 82f9a42
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions queries/analytics/eventData/getEventDataEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,46 @@ async function relationalQuery(
) {
const { rawQuery } = prisma;
const website = await loadWebsite(websiteId);
const { field, event } = filters;
const { event } = filters;

if (event) {
return rawQuery(
`
select
we.event_name as event,
ed.event_key as field,
ed.data_type as type,
ed.string_value as value,
count(ed.*) as total
from event_data as ed
inner join website_event as we
on we.event_id = ed.website_event_id
where ed.website_id = {{websiteId:uuid}}
and ed.event_key = {{field}}
where ed.website_id = {{websiteId::uuid}}
and ed.created_at between {{startDate}} and {{endDate}}
and we.event_name = {{event}}
group by ed.event_key, ed.string_value
order by 3 desc, 2 desc, 1 asc
group by we.event_name, ed.event_key, ed.data_type, ed.string_value
order by 1 asc, 2 asc, 3 asc, 4 desc
`,
{ ...filters, websiteId, startDate: maxDate(startDate, website.resetAt), endDate },
{ websiteId, startDate: maxDate(startDate, website.resetAt), endDate, ...filters },
);
}
return rawQuery(
`
select
we.event_name as event,
ed.event_key as field,
ed.string_value as value,
ed.data_type as type,
count(ed.*) as total
from event_data as ed
inner join website_event as we
on we.event_id = ed.website_event_id
where ed.website_id = {{websiteId::uuid}}
and ed.event_key = {{field}}
and ed.created_at between {{startDate}} and {{endDate}}
group by we.event_name, ed.event_key, ed.string_value
order by 3 desc, 2 desc, 1 asc
group by we.event_name, ed.event_key, ed.data_type
order by 1 asc, 2 asc
limit 100
`,
{ websiteId, field, startDate: maxDate(startDate, website.resetAt), endDate },
{ websiteId, startDate: maxDate(startDate, website.resetAt), endDate },
);
}

Expand Down

0 comments on commit 82f9a42

Please sign in to comment.