add dropoff percentages to funnel report

This commit is contained in:
Francis Cao 2023-07-21 00:14:37 -07:00
parent 94967d45e1
commit 858f465566
5 changed files with 15 additions and 7 deletions

View file

@ -31,6 +31,7 @@ async function relationalQuery(
{
x: string;
y: number;
z: number;
}[]
> {
const { windowMinutes, startDate, endDate, urls } = criteria;
@ -60,8 +61,12 @@ async function relationalQuery(
from levelCount;
`,
params,
).then((a: { [key: string]: number }) => {
return urls.map((b, i) => ({ x: b, y: a[0][`level${i + 1}`] || 0 }));
).then(results => {
return urls.map((a, i) => ({
x: a,
y: results[i]?.count || 0,
z: results[i]?.drop_off || 0,
}));
});
}