makeplane / makeplane/plane

🐛 Bug: Profile sidebar assigned count includes stale soft-deleted assignees

Open
#8,868 2 comments 0 reactions 1 assignee View on GitHub

@NarayanBavisetti is already working on this.

Since Apr 9, 2026.

Dominant language
TypeScript
Stars
59.6k
Forks
5.8k
Avg merge
1d 22h
Merged PRs (30d)
49

Description

Summary

The user profile page can show inconsistent assigned-work-item counts between the overview cards and the project sidebar breakdown.

Affected area

  • Profile overview cards
  • /[workspaceSlug]/profile/[userId]/assigned
  • Backend endpoint: WorkspaceUserProfileEndpoint

Symptoms

A user can see:

  • Work items assigned = 1 in the overview cards
  • but Assigned = 3 Work items in the profile sidebar/project summary

This happens when the user used to be assigned to additional work items, but those assignee relations were later removed.

Minimal reproduction

  1. Create a user and assign them to 3 work items in the same project.
  2. Remove the user from 2 of those work items so the corresponding IssueAssignee rows are soft-deleted.
  3. Open the user's profile overview and assigned tab.
  4. Observe:
    • the overview cards correctly show 1 assigned work item
    • the project sidebar breakdown can still show 3 assigned work items

Root cause

WorkspaceUserProfileEndpoint currently aggregates project counts with filters like:

  • project_issue__assignees__in=[user_id]

That can include stale rows from the IssueAssignee through table when older assignee records were soft-deleted.

Other profile count paths already guard against this by filtering active assignee relations with:

  • issue_assignee__deleted_at__isnull=True

So the profile sidebar can drift from the overview counts.

Expected behavior

Project-level assigned/completed/pending counts on the profile sidebar should only count active assignee relations.

Suggested fix

In WorkspaceUserProfileEndpoint, count assigned-related aggregates via active IssueAssignee rows instead of the raw M2M relation, for example:

  • project_issue__issue_assignee__assignee_id=user_id
  • project_issue__issue_assignee__deleted_at__isnull=True
  • distinct=True

Regression coverage

A regression test should cover:

  1. one active assignment
  2. two historical assignments whose IssueAssignee.deleted_at is set
  3. sidebar endpoint returns assigned_issues == 1, not 3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.