-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
chore(environments): Calculate cohorts for each environment #26554
Conversation
6ad03fc
to
7aa6034
Compare
f427eef
to
a34bd33
Compare
c624701
to
9ad70ee
Compare
posthog/api/cohort.py
Outdated
@@ -240,22 +238,31 @@ def update(self, cohort: Cohort, validated_data: dict, *args: Any, **kwargs: Any | |||
|
|||
is_deletion_change = deleted_state is not None and cohort.deleted != deleted_state | |||
if is_deletion_change: | |||
relevant_team_ids = ( | |||
Team.objects.order_by("id").filter(project_id=cohort.team.project_id).values_list("id", flat=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why we need order_by("id")
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I don't remember 😄 It's definitely superfluous here, removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me but will let Sandy comment on how this fits in with his rewrite + maybe @dmarticus as feature flags uses behavioural cohorts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Problem
Appendix A of the environments implementation plan.
Changes
recalculate_cohortpeople()
andclear_stale_cohortpeople()
now insert and clear cohort people for every team the cohort is available in, instead of just the one the cohort was created in.How did you test this code?
Added a test case to
test_cohort.py
. Definitely let me know how to improve test coverage!