fix(funnel): fallback to 0 if nan for funnel

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-03-23 22:13:10 +01:00
parent aeb9abcb13
commit f313356096
2 changed files with 8 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import { ifNaN } from '@openpanel/common';
import type { IChartEvent, IChartInput } from '@openpanel/validation';
import { last, reverse } from 'ramda';
import { escape } from 'sqlstring';
@@ -222,9 +223,10 @@ export class FunnelService {
}[],
)
.map((step, index, list) => {
const next = list[index + 1];
return {
...step,
percent: ifNaN(step.percent, 0),
dropoffPercent: ifNaN(step.dropoffPercent, 0),
isHighestDropoff: (() => {
// Skip if current step has no dropoff
if (!step?.dropoffCount) return false;