diff --git a/apiserver/plane/api/views/analytic.py b/apiserver/plane/api/views/analytic.py index 1691f3af6..28ffceab7 100644 --- a/apiserver/plane/api/views/analytic.py +++ b/apiserver/plane/api/views/analytic.py @@ -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, )