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 = {}
if x_axis in ["assignees__email"]:
assignee_avatars = Issue.objects.filter(
workspace__slug=slug, **filters
).values("assignees__avatar")
assignee_details = {}
if x_axis in ["assignees__email"] or segment in ["assignees__email"]:
assignee_details = (
Issue.objects.filter(workspace__slug=slug, **filters, assignees__avatar__isnull=False)
.order_by("assignees__id")
.distinct("assignees__id")
.values("assignees__avatar", "assignees__email", "assignees__first_name", "assignees__last_name")
)
return Response(
{
"total": total_issues,
"distribution": distribution,
"extras": {"colors": colors, "assignee_avatars": assignee_avatars},
"extras": {"colors": colors, "assignee_details": assignee_details},
},
status=status.HTTP_200_OK,
)