use pivot table for hasData column.
This commit is contained in:
1 parent
9f86462a54
commit
8a438e10ae
4 files changed
+9
-9
No files matched your search
@@ -114,7 +114,7 @@ const PropertiesButton = props => {
|
||||
</Icon>
|
||||
</Row>
|
||||
</Button>
|
||||
<Popover side="right">
|
||||
<Popover side="right" sideOffset={8}>
|
||||
<Dialog>
|
||||
<EventData {...props} />
|
||||
</Dialog>
|
||||
|
||||
@@ -98,7 +98,7 @@ const PropertiesButton = props => {
|
||||
</Icon>
|
||||
</Row>
|
||||
</Button>
|
||||
<Popover side="right">
|
||||
<Popover side="right" sideOffset={8}>
|
||||
<Dialog>
|
||||
<EventData {...props} />
|
||||
</Dialog>
|
||||
|
||||
@@ -124,10 +124,10 @@ describe('getWebsiteEvents', () => {
|
||||
expect(dataQuery).toContain('website_id as websiteId');
|
||||
expect(dataQuery).toContain('paged_event_data as (');
|
||||
expect(dataQuery).toContain('where website_id = {websiteId:UUID}');
|
||||
expect(dataQuery).toContain('from event_data');
|
||||
expect(dataQuery).toContain('inner join paged_events on paged_events.id = event_data.event_id');
|
||||
expect(dataQuery).toContain('from umami.event_data_pivot');
|
||||
expect(dataQuery).toContain('inner join paged_events on paged_events.id = event_data_pivot.event_id');
|
||||
expect(dataQuery).toContain(
|
||||
'and event_data.created_at between {startDate:DateTime64} and {endDate:DateTime64}',
|
||||
'and event_data_pivot.created_at between {startDate:DateTime64} and {endDate:DateTime64}',
|
||||
);
|
||||
expect(dataQuery).toContain('from paged_events');
|
||||
expect(dataQuery).toContain('left join paged_event_data on paged_event_data.event_id = paged_events.id');
|
||||
@@ -185,7 +185,7 @@ describe('getWebsiteEvents', () => {
|
||||
const [dataQuery] = clickhouseRawQuery.mock.calls[1];
|
||||
|
||||
expect(dataQuery).toContain(
|
||||
'and event_data.created_at between toTimezone({startDate:DateTime64},{timezone:String}) and toTimezone({endDate:DateTime64},{timezone:String})',
|
||||
'and event_data_pivot.created_at between toTimezone({startDate:DateTime64},{timezone:String}) and toTimezone({endDate:DateTime64},{timezone:String})',
|
||||
);
|
||||
expect(dataQuery).not.toContain(
|
||||
'and created_at between {startDate:DateTime64} and {endDate:DateTime64}',
|
||||
|
||||
@@ -114,7 +114,7 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
...filters,
|
||||
websiteId,
|
||||
});
|
||||
const hasDataDateQuery = dateQuery.replaceAll('created_at', 'event_data.created_at');
|
||||
const hasDataDateQuery = dateQuery.replaceAll('created_at', 'event_data_pivot.created_at');
|
||||
|
||||
const searchQuery = search
|
||||
? `and ((positionCaseInsensitive(event_name, {search:String}) > 0 and event_type = ${EVENT_TYPE.customEvent})
|
||||
@@ -176,8 +176,8 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
select
|
||||
event_id,
|
||||
toUInt8(1) as has_data
|
||||
from event_data
|
||||
inner join paged_events on paged_events.id = event_data.event_id
|
||||
from umami.event_data_pivot
|
||||
inner join paged_events on paged_events.id = event_data_pivot.event_id
|
||||
where website_id = {websiteId:UUID}
|
||||
${hasDataDateQuery}
|
||||
group by event_id
|
||||
|
||||
Reference in new issue
Block a user