-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(releases): Function to process a single group resolution #81119
Conversation
@@ -597,6 +456,169 @@ def handle_resolve_in_release( | |||
return result, res_type | |||
|
|||
|
|||
def process_group_resolution( |
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 only changes in this function compared to the original code are these (it removes our need to pass projects
and projects_look_up
:
diff --git a/src/sentry/api/helpers/group_index/update.py b/src/sentry/api/helpers/group_index/update.py
index e0f0a9db6c0..32bba6ece5e 100644
--- a/src/sentry/api/helpers/group_index/update.py
+++ b/src/sentry/api/helpers/group_index/update.py
@@ -488,8 +488,8 @@ def process_group_resolution(
if res_type == GroupResolution.Type.in_next_release:
# Check if semver versioning scheme is followed
follows_semver = follows_semver_versioning_scheme(
- org_id=group.project.organization_id,
- project_id=group.project_id,
+ org_id=group.organization.id,
+ project_id=group.project.id,
release_version=release.version,
)
@@ -527,7 +527,7 @@ def process_group_resolution(
# Get current release object from current_release_version
current_release_obj = Release.objects.get(
version=current_release_version,
- organization_id=group.project.organization_id,
+ organization_id=projects[0].organization_id,
)
date_order_q = Q(date_added__gt=current_release_obj.date_added) | Q(
@@ -540,8 +540,8 @@ def process_group_resolution(
resolved_in_release = (
Release.objects.filter(
date_order_q,
- projects=group.project,
- organization_id=group.project.organization_id,
+ projects=projects[0],
+ organization_id=projects[0].organization_id,
)
.extra(select={"sort": "COALESCE(date_released, date_added)"})
.order_by("sort", "id")[:1]
@@ -604,7 +604,7 @@ def process_group_resolution(
if created:
activity = Activity.objects.create(
- project=group.project,
+ project=project_lookup[group.project_id],
group=group,
type=activity_type,
user_id=acting_user.id,
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.
Is projects[0]
the same as group.project
?
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.
It is a terrible code to read but yet it is.
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #81119 +/- ##
==========================================
- Coverage 78.47% 78.47% -0.01%
==========================================
Files 7215 7215
Lines 319847 319849 +2
Branches 44057 44057
==========================================
- Hits 251012 251006 -6
- Misses 62440 62446 +6
- Partials 6395 6397 +2 |
No description provided.