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

Allow Excluding Multiple Events + events in unordered funnels #5150

Merged
merged 17 commits into from
Jul 27, 2021

Conversation

neilkakkar
Copy link
Collaborator

@neilkakkar neilkakkar commented Jul 15, 2021

Don't merge until SQL injection issue is resolved

~~To go after #5104 ~~

Fixes #5074

Changes

Event exclusion in unordered events
Support for multiple exclusions in the same step in ordered + unordered funnels

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests
  • Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
  • New/changed UI is decent on smartphones (viewport width around 360px)

@neilkakkar neilkakkar marked this pull request as draft July 15, 2021 11:26
@timgl timgl temporarily deployed to posthog-pr-5150 July 15, 2021 11:27 Inactive
@timgl timgl temporarily deployed to posthog-pr-5150 July 15, 2021 13:01 Inactive
@neilkakkar neilkakkar marked this pull request as ready for review July 15, 2021 14:40
@@ -89,6 +90,11 @@ class ExclusionEntity(Entity, FunnelFromToStepsMixin):
def __init__(self, data: Dict[str, Any]) -> None:
super().__init__(data)

@property
def sql_id(self):
# TODO: prevent SQL injection :(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably just using a UUID here works.

Had other higher priority bugs to look into, will come back to this on Tuesday.

@timgl timgl temporarily deployed to posthog-pr-5150 July 20, 2021 10:28 Inactive
@neilkakkar neilkakkar requested a review from EDsCODE July 20, 2021 10:31
@neilkakkar neilkakkar changed the title Allow Excluding events in unordered funnels Allow Excluding Multiple Events + events in unordered funnels Jul 20, 2021
@timgl timgl temporarily deployed to posthog-pr-5150 July 20, 2021 10:33 Inactive
ee/clickhouse/queries/funnels/test/test_funnel.py Outdated Show resolved Hide resolved
to_time = f"event_times[{exclusion.funnel_to_step + 1}]"
exclusion_time = f"exclusion_{exclusion_id}_latest_{exclusion.funnel_from_step}"
condition = (
f"if( {exclusion_time} > {from_time} AND {exclusion_time} < "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "<" supposed to be trailing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiple strings! These get concatenated automatically when enclosed in a paranthesis.

Felt clearer to me, about what's happening in the "<" (the next line)

@timgl timgl temporarily deployed to posthog-pr-5150 July 22, 2021 08:30 Inactive
@timgl timgl temporarily deployed to posthog-pr-5150 July 22, 2021 08:55 Inactive
@neilkakkar neilkakkar requested a review from EDsCODE July 22, 2021 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Excluding Events in Funnels
3 participants