[WEB-1909] chore: removed duplication of assignee and label activity (#5095)

* chore: removed duplication of assignee and label activity

* chore: removed the print statement

* chore: updated the queryset
This commit is contained in:
Bavisetti Narayan 2024-07-11 14:43:02 +05:30 committed by GitHub
parent 15b0a448ee
commit 24973c1386
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -481,7 +481,38 @@ class IssueViewSet(BaseViewSet):
return Response(serializer.data, status=status.HTTP_200_OK)
def partial_update(self, request, slug, project_id, pk=None):
issue = self.get_queryset().filter(pk=pk).first()
issue = (
self.get_queryset()
.annotate(
label_ids=Coalesce(
ArrayAgg(
"labels__id",
distinct=True,
filter=~Q(labels__id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
assignee_ids=Coalesce(
ArrayAgg(
"assignees__id",
distinct=True,
filter=~Q(assignees__id__isnull=True)
& Q(assignees__member_project__is_active=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
module_ids=Coalesce(
ArrayAgg(
"issue_module__module_id",
distinct=True,
filter=~Q(issue_module__module_id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
)
.filter(pk=pk)
.first()
)
if not issue:
return Response(