feat: show revenue amount on event list (if revenue)
This commit is contained in:
@@ -27,7 +27,7 @@ export function useColumns() {
|
|||||||
accessorKey: 'name',
|
accessorKey: 'name',
|
||||||
header: 'Name',
|
header: 'Name',
|
||||||
cell({ row }) {
|
cell({ row }) {
|
||||||
const { name, path, duration, properties } = row.original;
|
const { name, path, duration, properties, revenue } = row.original;
|
||||||
const renderName = () => {
|
const renderName = () => {
|
||||||
if (name === 'screen_view') {
|
if (name === 'screen_view') {
|
||||||
if (path.includes('/')) {
|
if (path.includes('/')) {
|
||||||
@@ -42,6 +42,10 @@ export function useColumns() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name === 'revenue' && revenue) {
|
||||||
|
return `${name} (${number.currency(revenue / 100)})`;
|
||||||
|
}
|
||||||
|
|
||||||
return name.replace(/_/g, ' ');
|
return name.replace(/_/g, ' ');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -592,6 +592,9 @@ export async function getEventList(options: GetEventListOptions) {
|
|||||||
if (select.sdkVersion) {
|
if (select.sdkVersion) {
|
||||||
sb.select.sdkVersion = 'sdk_version';
|
sb.select.sdkVersion = 'sdk_version';
|
||||||
}
|
}
|
||||||
|
if (select.revenue) {
|
||||||
|
sb.select.revenue = 'revenue';
|
||||||
|
}
|
||||||
|
|
||||||
if (profileId) {
|
if (profileId) {
|
||||||
sb.where.deviceId = `(device_id IN (SELECT device_id as did FROM ${TABLE_NAMES.events} WHERE project_id = ${sqlstring.escape(projectId)} AND device_id != '' AND profile_id = ${sqlstring.escape(profileId)} group by did) OR profile_id = ${sqlstring.escape(profileId)})`;
|
sb.where.deviceId = `(device_id IN (SELECT device_id as did FROM ${TABLE_NAMES.events} WHERE project_id = ${sqlstring.escape(projectId)} AND device_id != '' AND profile_id = ${sqlstring.escape(profileId)} group by did) OR profile_id = ${sqlstring.escape(profileId)})`;
|
||||||
|
|||||||
@@ -10,12 +10,10 @@ import {
|
|||||||
convertClickhouseDateToJs,
|
convertClickhouseDateToJs,
|
||||||
db,
|
db,
|
||||||
eventService,
|
eventService,
|
||||||
formatClickhouseDate,
|
|
||||||
getChartStartEndDate,
|
getChartStartEndDate,
|
||||||
getConversionEventNames,
|
getConversionEventNames,
|
||||||
getEventList,
|
getEventList,
|
||||||
getEventMetasCached,
|
getEventMetasCached,
|
||||||
getEvents,
|
|
||||||
getSettingsForProject,
|
getSettingsForProject,
|
||||||
overviewService,
|
overviewService,
|
||||||
sessionService,
|
sessionService,
|
||||||
@@ -143,6 +141,7 @@ export const eventRouter = createTRPCRouter({
|
|||||||
path: columnVisibility?.name ?? true,
|
path: columnVisibility?.name ?? true,
|
||||||
duration: columnVisibility?.name ?? true,
|
duration: columnVisibility?.name ?? true,
|
||||||
projectId: false,
|
projectId: false,
|
||||||
|
revenue: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -221,6 +220,7 @@ export const eventRouter = createTRPCRouter({
|
|||||||
path: columnVisibility?.name ?? true,
|
path: columnVisibility?.name ?? true,
|
||||||
duration: columnVisibility?.name ?? true,
|
duration: columnVisibility?.name ?? true,
|
||||||
projectId: false,
|
projectId: false,
|
||||||
|
revenue: true,
|
||||||
},
|
},
|
||||||
custom: (sb) => {
|
custom: (sb) => {
|
||||||
sb.where.name = `name IN (${filteredConversions.map((event) => sqlstring.escape(event.name)).join(',')})`;
|
sb.where.name = `name IN (${filteredConversions.map((event) => sqlstring.escape(event.name)).join(',')})`;
|
||||||
|
|||||||
Reference in New Issue
Block a user