fix region / city filters

This commit is contained in:
Francis Cao 2023-04-17 00:10:51 -07:00
parent 672608b2f5
commit 43499eb4fd
5 changed files with 18 additions and 22 deletions

View File

@ -16,11 +16,14 @@ export default function MetricsBar({ websiteId }) {
const { startDate, endDate, modified } = dateRange;
const [format, setFormat] = useState(true);
const {
query: { url, referrer, os, browser, device, country },
query: { url, referrer, os, browser, device, country, region, city },
} = usePageQuery();
const { data, error, isLoading, isFetched } = useQuery(
['websites:stats', { websiteId, modified, url, referrer, os, browser, device, country }],
[
'websites:stats',
{ websiteId, modified, url, referrer, os, browser, device, country, region, city },
],
() =>
get(`/websites/${websiteId}/stats`, {
startAt: +startDate,
@ -31,6 +34,8 @@ export default function MetricsBar({ websiteId }) {
browser,
device,
country,
region,
city,
}),
);

View File

@ -127,11 +127,11 @@ function parseFilters(
params = [],
sessionKey = 'session_id',
) {
const { os, browser, device, country, subdivision1, subdivision2, city } = filters;
const { os, browser, device, country, region, city } = filters;
return {
joinSession:
os || browser || device || country || subdivision1 || subdivision2 || city
os || browser || device || country || region || city
? `inner join session on website_event.${sessionKey} = session.${sessionKey}`
: '',
filterQuery: getFilterQuery(filters, params),

View File

@ -82,8 +82,7 @@ export interface WebsiteMetricFilter {
browser?: string;
device?: string;
country?: string;
subdivision1?: string;
subdivision2?: string;
region?: string;
city?: string;
}

View File

@ -21,8 +21,7 @@ export interface WebsitePageviewRequestQuery {
browser?: string;
device?: string;
country?: string;
subdivision1?: string;
subdivision2?: string;
region: string;
city?: string;
}
@ -46,8 +45,7 @@ export default async (
browser,
device,
country,
subdivision1,
subdivision2,
region,
city,
} = req.query;
@ -78,8 +76,7 @@ export default async (
browser,
device,
country,
subdivision1,
subdivision2,
region,
city,
},
}),
@ -96,8 +93,7 @@ export default async (
browser,
device,
country,
subdivision1,
subdivision2,
region,
city,
},
}),

View File

@ -18,8 +18,7 @@ export interface WebsiteStatsRequestQuery {
browser: string;
device: string;
country: string;
subdivision1: string;
subdivision2: string;
region: string;
city: string;
}
@ -43,8 +42,7 @@ export default async (
browser,
device,
country,
subdivision1,
subdivision2,
region,
city,
} = req.query;
@ -73,8 +71,7 @@ export default async (
browser,
device,
country,
subdivision1,
subdivision2,
region,
city,
},
});
@ -91,8 +88,7 @@ export default async (
browser,
device,
country,
subdivision1,
subdivision2,
region,
city,
},
});