diff --git a/apiserver/plane/app/views/dashboard/base.py b/apiserver/plane/app/views/dashboard/base.py index 09152784c60..ff67bb73b95 100644 --- a/apiserver/plane/app/views/dashboard/base.py +++ b/apiserver/plane/app/views/dashboard/base.py @@ -133,10 +133,13 @@ def dashboard_overview_stats(self, request, slug): completed_issues_count = ( Issue.issue_objects.filter( + ( + Q(assignees__in=[request.user]) + & Q(issue_assignee__deleted_at__isnull=True) + ), workspace__slug=slug, project__project_projectmember__is_active=True, project__project_projectmember__member=request.user, - assignees__in=[request.user], state__group="completed", ) .filter( diff --git a/apiserver/plane/app/views/workspace/user.py b/apiserver/plane/app/views/workspace/user.py index 0010b4ae700..cc1caa92c09 100644 --- a/apiserver/plane/app/views/workspace/user.py +++ b/apiserver/plane/app/views/workspace/user.py @@ -375,8 +375,11 @@ def get(self, request, slug, user_id): state_distribution = ( Issue.issue_objects.filter( + ( + Q(assignees__in=[user_id]) + & Q(issue_assignee__deleted_at__isnull=True) + ), workspace__slug=slug, - assignees__in=[user_id], project__project_projectmember__member=request.user, project__project_projectmember__is_active=True, ) @@ -391,8 +394,11 @@ def get(self, request, slug, user_id): priority_distribution = ( Issue.issue_objects.filter( + ( + Q(assignees__in=[user_id]) + & Q(issue_assignee__deleted_at__isnull=True) + ), workspace__slug=slug, - assignees__in=[user_id], project__project_projectmember__member=request.user, project__project_projectmember__is_active=True, ) @@ -426,8 +432,11 @@ def get(self, request, slug, user_id): assigned_issues_count = ( Issue.issue_objects.filter( + ( + Q(assignees__in=[user_id]) + & Q(issue_assignee__deleted_at__isnull=True) + ), workspace__slug=slug, - assignees__in=[user_id], project__project_projectmember__member=request.user, project__project_projectmember__is_active=True, ) @@ -438,8 +447,11 @@ def get(self, request, slug, user_id): pending_issues_count = ( Issue.issue_objects.filter( ~Q(state__group__in=["completed", "cancelled"]), + ( + Q(assignees__in=[user_id]) + & Q(issue_assignee__deleted_at__isnull=True) + ), workspace__slug=slug, - assignees__in=[user_id], project__project_projectmember__member=request.user, project__project_projectmember__is_active=True, ) @@ -449,8 +461,11 @@ def get(self, request, slug, user_id): completed_issues_count = ( Issue.issue_objects.filter( + ( + Q(assignees__in=[user_id]) + & Q(issue_assignee__deleted_at__isnull=True) + ), workspace__slug=slug, - assignees__in=[user_id], state__group="completed", project__project_projectmember__member=request.user, project__project_projectmember__is_active=True,