add new filter for checking if profile is set or generated
This commit is contained in:
@@ -112,6 +112,15 @@ export function getEventFiltersWhereClause(filters: IChartEventFilter[]) {
|
|||||||
|
|
||||||
if (value.length === 0) return;
|
if (value.length === 0) return;
|
||||||
|
|
||||||
|
if (name === 'has_profile') {
|
||||||
|
if (value.includes('true')) {
|
||||||
|
where[id] = `profile_id != device_id`;
|
||||||
|
} else {
|
||||||
|
where[id] = `profile_id = device_id`;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (name.startsWith('properties.')) {
|
if (name.startsWith('properties.')) {
|
||||||
const whereFrom = `mapValues(mapExtractKeyLike(properties, ${escape(
|
const whereFrom = `mapValues(mapExtractKeyLike(properties, ${escape(
|
||||||
name.replace(/^properties\./, '').replace('.*.', '.%.')
|
name.replace(/^properties\./, '').replace('.*.', '.%.')
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ export const chartRouter = createTRPCRouter({
|
|||||||
.map((item) => `properties.${item}`);
|
.map((item) => `properties.${item}`);
|
||||||
|
|
||||||
properties.push(
|
properties.push(
|
||||||
|
'has_profile',
|
||||||
'name',
|
'name',
|
||||||
'path',
|
'path',
|
||||||
'referrer',
|
'referrer',
|
||||||
@@ -119,6 +120,12 @@ export const chartRouter = createTRPCRouter({
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.query(async ({ input: { event, property, projectId } }) => {
|
.query(async ({ input: { event, property, projectId } }) => {
|
||||||
|
if (property === 'has_profile') {
|
||||||
|
return {
|
||||||
|
values: ['true', 'false'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const { sb, getSql } = createSqlBuilder();
|
const { sb, getSql } = createSqlBuilder();
|
||||||
sb.where.project_id = `project_id = ${escape(projectId)}`;
|
sb.where.project_id = `project_id = ${escape(projectId)}`;
|
||||||
if (event !== '*') {
|
if (event !== '*') {
|
||||||
|
|||||||
Reference in New Issue
Block a user