From 5795cb272d967636dd7adac9d92efeb63adefee9 Mon Sep 17 00:00:00 2001 From: Julian Bez Date: Fri, 22 Mar 2024 11:23:30 +0100 Subject: [PATCH] Fix code review suggestions --- .../InsightQuery/utils/filtersToQueryNode.ts | 18 ++++++++---------- .../insights/paths_query_runner.py | 3 --- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.ts b/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.ts index e690ac4115b09..61c7ce5584d8b 100644 --- a/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.ts +++ b/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.ts @@ -475,16 +475,14 @@ export const pathsFilterToQuery = (filters: Partial): PathsFilt pathGroupings: filters.path_groupings, funnelPaths: filters.funnel_paths, funnelFilter: filters.funnel_filter, - funnelActorsQuery: filters.funnel_filter - ? ({ - kind: NodeKind.FunnelsActorsQuery, - source: { - funnelsFilter: funnelsFilterToQuery(filters.funnel_filter), - ...filtersToQueryNode(filters.funnel_filter), - }, - funnelStep: filters.funnel_filter.funnel_step, - } as FunnelsActorsQuery) - : undefined, + funnelActorsQuery: + filters.funnel_filter && Object.keys(filters.funnel_filter).length > 0 + ? ({ + kind: NodeKind.FunnelsActorsQuery, + source: filtersToQueryNode(filters.funnel_filter), + funnelStep: filters.funnel_filter.funnel_step, + } as FunnelsActorsQuery) + : undefined, excludeEvents: filters.exclude_events, stepLimit: filters.step_limit, pathReplacements: filters.path_replacements, diff --git a/posthog/hogql_queries/insights/paths_query_runner.py b/posthog/hogql_queries/insights/paths_query_runner.py index 5e10a41e9851e..6bd34722fbe5b 100644 --- a/posthog/hogql_queries/insights/paths_query_runner.py +++ b/posthog/hogql_queries/insights/paths_query_runner.py @@ -520,9 +520,6 @@ def get_session_threshold_clause(self) -> ast.Expr: interval = self.query.pathsFilter.funnelActorsQuery.source.funnelsFilter.funnelWindowInterval unit = self.query.pathsFilter.funnelActorsQuery.source.funnelsFilter.funnelWindowIntervalUnit interval_unit = funnel_window_interval_unit_to_sql(unit) - # TODO: Figure out if funnelWindowDays still used - # elif self.query.pathsFilter.funnelActorsQuery.source.funnelsFilter.funnelWindowDays: - # interval = self.query.pathsFilter.funnelActorsQuery.source.funnelsFilter.funnelWindowDays return parse_expr( f"arraySplit(x -> if(toDateTime('2018-01-01') + toIntervalSecond(_toInt64(x.3)) < toDateTime('2018-01-01') + INTERVAL {interval} {interval_unit}, 0, 1), paths_tuple)"