funnel checkpoint

This commit is contained in:
Brian Cao 2023-05-15 14:03:42 -07:00
parent ebc8cb488a
commit b5f84159d2
8 changed files with 21 additions and 12 deletions

View file

@ -74,7 +74,7 @@ async function clickhouseQuery(
{
level: number;
url: string;
count: any;
count: number;
}[]
> {
const { windowMinutes, startDate, endDate, urls } = criteria;
@ -108,9 +108,11 @@ async function clickhouseQuery(
ORDER BY level ASC;
`,
params,
).then(a => {
return a
.filter(b => b.level !== 0)
.map((c, i) => ({ level: c.level, url: urls[i], count: c.count }));
).then(results => {
return urls.map((a, i) => ({
level: i + 1,
url: a,
count: results[i + 1]?.count || 0,
}));
});
}