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(cohorts): Fix all events action with cohorts #27675

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

timgl
Copy link
Collaborator

@timgl timgl commented Jan 20, 2025

Problem

Cohorts that have an action with "all events" selected returns 0 people

Changes

Fix that

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

@timgl timgl enabled auto-merge (squash) January 20, 2025 03:28
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Fixed an issue where cohorts with an "all events" action were returning 0 people by modifying the event condition logic in the SQL query generation.

  • Modified _get_behavior_subquery() in foss_cohort_query.py to only add event filtering when specific events are defined
  • Added test case test_cohortpeople_action_all_events to verify cohorts match any event when no specific event is defined
  • Ensures cohort queries now correctly include people who performed any event within the specified time window
  • Maintains existing behavior for cohorts with specific event filters
  • Simple fix that addresses the core issue without introducing complexity

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@anirudhpillai anirudhpillai left a comment

Choose a reason for hiding this comment

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

💯

@timgl timgl merged commit 4812eb8 into master Jan 20, 2025
93 checks passed
@timgl timgl deleted the fix-cohort-all-evetns branch January 20, 2025 21:54
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.

2 participants