-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: split funnel trends and steps flags (#24949)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
30dbf91
commit a6b229f
Showing
10 changed files
with
198 additions
and
556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
362 changes: 0 additions & 362 deletions
362
posthog/hogql_queries/insights/funnels/test/__snapshots__/test_funnel_trends_udf.ambr
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 49 additions & 2 deletions
51
posthog/hogql_queries/insights/funnels/test/test_funnel_trends_udf.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,55 @@ | ||
from typing import cast | ||
from unittest.mock import patch, Mock | ||
|
||
from posthog.constants import INSIGHT_FUNNELS, TRENDS_LINEAR | ||
from posthog.hogql_queries.insights.funnels.funnels_query_runner import FunnelsQueryRunner | ||
from posthog.hogql_queries.insights.funnels.test.test_funnel_trends import BaseTestFunnelTrends | ||
from posthog.hogql_queries.legacy_compatibility.filter_to_query import filter_to_query | ||
from posthog.schema import FunnelsQuery, FunnelsQueryResponse | ||
|
||
|
||
@patch("posthoganalytics.feature_enabled", new=Mock(return_value=True)) | ||
@patch( | ||
"posthoganalytics.feature_enabled", | ||
new=Mock(side_effect=lambda key, *args, **kwargs: key == "insight-funnels-use-udf-trends"), | ||
) | ||
class TestFunnelTrendsUDF(BaseTestFunnelTrends): | ||
pass | ||
__test__ = True | ||
|
||
def test_assert_trends_flag_is_on(self): | ||
filters = { | ||
"insight": INSIGHT_FUNNELS, | ||
"funnel_viz_type": "trends", | ||
"display": TRENDS_LINEAR, | ||
"interval": "hour", | ||
"date_from": "2021-05-01 00:00:00", | ||
"funnel_window_interval": 7, | ||
"events": [ | ||
{"id": "step one", "order": 0}, | ||
{"id": "step two", "order": 1}, | ||
{"id": "step three", "order": 2}, | ||
], | ||
} | ||
|
||
query = cast(FunnelsQuery, filter_to_query(filters)) | ||
results = cast(FunnelsQueryResponse, FunnelsQueryRunner(query=query, team=self.team).calculate()) | ||
|
||
self.assertTrue(results.isUdf) | ||
|
||
def test_assert_steps_flag_is_off(self): | ||
filters = { | ||
"insight": INSIGHT_FUNNELS, | ||
"funnel_viz_type": "steps", | ||
"interval": "hour", | ||
"date_from": "2021-05-01 00:00:00", | ||
"funnel_window_interval": 7, | ||
"events": [ | ||
{"id": "step one", "order": 0}, | ||
{"id": "step two", "order": 1}, | ||
{"id": "step three", "order": 2}, | ||
], | ||
} | ||
|
||
query = cast(FunnelsQuery, filter_to_query(filters)) | ||
results = cast(FunnelsQueryResponse, FunnelsQueryRunner(query=query, team=self.team).calculate()) | ||
|
||
self.assertFalse(results.isUdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.