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
- Create a user and assign them to 3 work items in the same project.
- Remove the user from 2 of those work items so the corresponding
IssueAssignee rows are soft-deleted.
- Open the user's profile overview and assigned tab.
- 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:
- one active assignment
- two historical assignments whose
IssueAssignee.deleted_at is set
- sidebar endpoint returns
assigned_issues == 1, not 3
Summary
The user profile page can show inconsistent assigned-work-item counts between the overview cards and the project sidebar breakdown.
Affected area
/[workspaceSlug]/profile/[userId]/assignedWorkspaceUserProfileEndpointSymptoms
A user can see:
Work items assigned = 1in the overview cardsAssigned = 3 Work itemsin the profile sidebar/project summaryThis happens when the user used to be assigned to additional work items, but those assignee relations were later removed.
Minimal reproduction
IssueAssigneerows are soft-deleted.1assigned work item3assigned work itemsRoot cause
WorkspaceUserProfileEndpointcurrently aggregates project counts with filters like:project_issue__assignees__in=[user_id]That can include stale rows from the
IssueAssigneethrough 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=TrueSo 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 activeIssueAssigneerows instead of the raw M2M relation, for example:project_issue__issue_assignee__assignee_id=user_idproject_issue__issue_assignee__deleted_at__isnull=Truedistinct=TrueRegression coverage
A regression test should cover:
IssueAssignee.deleted_atis setassigned_issues == 1, not3