Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(funnels): rename variable #13984

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions posthog/queries/funnels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def _get_inner_event_query(
for prop in self._include_properties:
extra_fields.append(prop)

inner_query, params = FunnelEventQuery(
funnel_events_query, params = FunnelEventQuery(
filter=self._filter,
team=self._team,
extra_fields=[*self._extra_event_fields, *extra_fields],
Expand Down Expand Up @@ -433,24 +433,23 @@ def _get_inner_event_query(
if self._filter.breakdown:
if self._filter.breakdown_type == "cohort":
extra_join = self._get_cohort_breakdown_join()

else:
values = self._get_breakdown_conditions()
self.params.update({"breakdown_values": values})

extra_select_fields = f", {', '.join(all_step_cols)}" if all_step_cols else ""

inner_query = inner_query.format(
funnel_events_query = funnel_events_query.format(
extra_select_fields=extra_select_fields,
extra_join=extra_join,
step_filter="AND ({})".format(steps_conditions),
)

if self._filter.breakdown and self._filter.breakdown_attribution_type != BreakdownAttributionType.ALL_EVENTS:
# ALL_EVENTS attribution is the old default, which doesn't need the subquery
return self._add_breakdown_attribution_subquery(inner_query)
return self._add_breakdown_attribution_subquery(funnel_events_query)

return inner_query
return funnel_events_query

def _add_breakdown_attribution_subquery(self, inner_query: str) -> str:
if self._filter.breakdown_attribution_type in [
Expand Down