Skip to content

Commit

Permalink
fix(releases): Include fix within get_current_release_version_of_group()
Browse files Browse the repository at this point in the history
In #80737 we provided a fix within `get_latest_release()` but it makes more sense to include inside of `get_current_release_version_of_group()` for it will make it available to other parts of the codebase. For example:
https://github.com/getsentry/sentry/blob/c0797226ec0dc304d766796713121a880df38811/src/sentry/integrations/tasks/sync_status_inbound.py#L112-L114
  • Loading branch information
armenzg committed Nov 15, 2024
1 parent 444110a commit a4c711f
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions src/sentry/api/helpers/group_index/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,22 @@ def get_current_release_version_of_group(group: Group, follows_semver: bool = Fa
current_release_version = None
if follows_semver:
try:
# This sets current_release_version to the latest semver version associated with a group
associated_release_id = GroupRelease.objects.filter(
project_id=group.project.id, group_id=group.id
).values_list("release_id")

current_release_version = (
get_semver_releases(group.project)
.filter(id__in=associated_release_id)
.values_list("version", flat=True)[:1]
.get()
)
if not features.has(
"organizations:releases-resolve-next-release-semver-fix", group.project.organization
):
# This sets current_release_version to the latest semver version associated with a group
associated_release_id = GroupRelease.objects.filter(
project_id=group.project.id, group_id=group.id
).values_list("release_id")
current_release_version = (
get_semver_releases(group.project)
.filter(id__in=associated_release_id)
.values_list("version", flat=True)[:1]
.get()
)
else:
current_release_version = greatest_semver_release(group.project).version

except Release.DoesNotExist:
pass
else:
Expand Down Expand Up @@ -404,18 +409,9 @@ def update_groups(
release_version=release.version,
)

if (
features.has(
"organizations:releases-resolve-next-release-semver-fix",
project.organization,
)
and follows_semver
):
current_release_version = get_release_to_resolve_by(projects[0]).version
else:
current_release_version = get_current_release_version_of_group(
group=group, follows_semver=follows_semver
)
current_release_version = get_current_release_version_of_group(
group, follows_semver
)

if current_release_version:
resolution_params.update(
Expand Down

0 comments on commit a4c711f

Please sign in to comment.