chore: cycle endpoint to return display name as well in the assignee distribution (#2041)

* chore: cycle endpoint to return display name as well in the assignee distribution

* fix: value error
This commit is contained in:
Nikhil 2023-09-01 11:21:34 +05:30 committed by GitHub
parent eab1d9329b
commit 3a0d96a48d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -191,11 +191,10 @@ class CycleViewSet(BaseViewSet):
workspace__slug=slug, workspace__slug=slug,
project_id=project_id, project_id=project_id,
) )
.annotate(first_name=F("assignees__first_name")) .annotate(display_name=F("assignees__display_name"))
.annotate(last_name=F("assignees__last_name"))
.annotate(assignee_id=F("assignees__id")) .annotate(assignee_id=F("assignees__id"))
.annotate(avatar=F("assignees__avatar")) .annotate(avatar=F("assignees__avatar"))
.values("first_name", "last_name", "assignee_id", "avatar") .values("display_name", "assignee_id", "avatar")
.annotate(total_issues=Count("assignee_id")) .annotate(total_issues=Count("assignee_id"))
.annotate( .annotate(
completed_issues=Count( completed_issues=Count(
@ -209,7 +208,7 @@ class CycleViewSet(BaseViewSet):
filter=Q(completed_at__isnull=True), filter=Q(completed_at__isnull=True),
) )
) )
.order_by("first_name", "last_name") .order_by("display_name")
) )
label_distribution = ( label_distribution = (