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

fix(funnels): actors modal for groups #21612

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions posthog/hogql_queries/insights/insight_actors_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
HogQLQueryResponse,
StickinessQuery,
TrendsQuery,
FunnelsQuery,
)
from posthog.types import InsightActorsQueryNode

Expand Down Expand Up @@ -84,6 +85,11 @@ def group_type_index(self) -> int | None:
assert isinstance(self.query.source, FunnelCorrelationQuery)
return self.query.source.source.source.aggregation_group_type_index

if isinstance(self.source_runner, FunnelsQueryRunner):
assert isinstance(self.query, FunnelsActorsQuery)
assert isinstance(self.query.source, FunnelsQuery)
return self.query.source.aggregation_group_type_index

if (
isinstance(self.source_runner, StickinessQueryRunner) and isinstance(self.query.source, StickinessQuery)
) or (isinstance(self.source_runner, TrendsQueryRunner) and isinstance(self.query.source, TrendsQuery)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,32 @@ def test_insight_persons_funnels_query(self):
)

self.assertEqual([("p1",), ("p2",)], response.results)

def test_insight_groups_funnels_query(self):
self._create_test_groups()
self._create_test_events()
self.team.timezone = "US/Pacific"
self.team.save()

response = self.select(
"""
select * from (
<ActorsQuery select={['properties.name']}>
<FunnelsActorsQuery funnelStep={2}>
<FunnelsQuery
aggregation_group_type_index={0}
dateRange={<DateRange date_from='2020-01-01' date_to='2020-01-19' />}
series={[<EventsNode event='$pageview' />, <EventsNode event='$pageview' />]}
/>
</FunnelsActorsQuery>
</ActorsQuery>
)
"""
)

self.assertEqual(
[
("org1",),
],
response.results,
)
Loading