fix: issue assignee multiple values (#1056)

* fix: issue assignee multiple values

* chore: return first name and last name

* dev: keys update and also send data when segmented
This commit is contained in:
pablohashescobar 2023-05-17 00:46:41 +05:30 committed by GitHub
parent d99f85ce05
commit c49b0d6151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,17 +76,21 @@ class AnalyticsEndpoint(BaseAPIView):
) )
) )
assignee_avatars = {} assignee_details = {}
if x_axis in ["assignees__email"]: if x_axis in ["assignees__email"] or segment in ["assignees__email"]:
assignee_avatars = Issue.objects.filter( assignee_details = (
workspace__slug=slug, **filters Issue.objects.filter(workspace__slug=slug, **filters, assignees__avatar__isnull=False)
).values("assignees__avatar") .order_by("assignees__id")
.distinct("assignees__id")
.values("assignees__avatar", "assignees__email", "assignees__first_name", "assignees__last_name")
)
return Response( return Response(
{ {
"total": total_issues, "total": total_issues,
"distribution": distribution, "distribution": distribution,
"extras": {"colors": colors, "assignee_avatars": assignee_avatars}, "extras": {"colors": colors, "assignee_details": assignee_details},
}, },
status=status.HTTP_200_OK, status=status.HTTP_200_OK,
) )