-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(aci): Only update open periods if the initial one exists #90079
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
base: master
Are you sure you want to change the base?
Conversation
if features.has( | ||
"organizations:issue-open-periods", group.project.organization | ||
) and has_initial_open_period(group): |
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.
Sorry for the larger diff - calling out the logic changes
@@ -1063,185 +1061,3 @@ def pre_save_group_default_substatus(instance, sender, *args, **kwargs): | |||
"No substatus allowed for group", | |||
extra={"status": instance.status, "substatus": instance.substatus}, | |||
) | |||
|
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.
all of this is moved to groupopenperiod.py
# Until we've backfilled the GroupOpenPeriod table, we don't want to update open periods for | ||
# groups that weren't initially created with one. | ||
if not has_initial_open_period(group): | ||
return |
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.
the other bit of new logic, along with the function def at the end of the file
def has_initial_open_period(group: Group) -> bool: | ||
return GroupOpenPeriod.objects.filter(group=group, date_started__lte=group.first_seen).exists() |
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.
last new piece
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #90079 +/- ##
========================================
Coverage 87.64% 87.65%
========================================
Files 10250 10260 +10
Lines 577029 577652 +623
Branches 22719 22719
========================================
+ Hits 505725 506321 +596
- Misses 70861 70888 +27
Partials 443 443 |
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.
These changes look good to me, but I think we need a test to validate
whoops, added tests |
Step 1 to get us ready for the open period backfill
In order to cleanly backfill open periods, we need to change the existing open period logic to only update an open period for a group if the group has the initial open period (from group creation). If it doesn't, then do nothing. If it does, handle the open periods as usual.
This PR makes that change, using
has_initial_open_period
to check for an open period that matches thegroup.first_seen
time.I've also relocated all the open period methods to
groupopenperiod.py
instead ofgroup.py
.