[bug]: Assignee distribution in cycle/module analytics counts soft-deleted assignees and inflates totals

Aperta
#10,363 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@1-LEI-DE-NEWTON ci sta già lavorando.

Dal 21/11/2026.

  • #10364 di @1-LEI-DE-NEWTON — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, python
Ambito
analytics

Direzione di ricerca

Start with the assignee aggregation in CycleAnalyticsEndpoint in apps/api/plane/app/views/cycle/base.py, then check the matching blocks in cycle/archive.py, module/base.py and analytic/project_analytics.py. The join on issue_assignees needs a deleted_at IS NULL filter, and the count needs to be distinct per work item rather than per row. Done means the Assignees breakdown matches the filtered work item list for the same cycle, with a regression test covering a soft-deleted reassignment.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is there an existing issue for this?
  • I have searched the existing issues

(Closest I found: #8868, same root cause in the profile endpoint.)

Current behavior

The "Assignees" breakdown of a cycle (active cycle page, /cycles/<id>/analytics/, archived cycles) and of a module reports more work items per assignee than the assignee really has. The numbers don't match the filtered work item list of the same cycle.

Example from a self-hosted instance (cycle with 102 work items, one assignee):

  • Assignees panel: 69 work items (27 completed, 42 pending)
  • Work item list filtered by that assignee: 47 (18 completed, 29 pending)

Other assignees in the same cycle are inflated too (e.g. 19 vs 8, 31 vs 16).

Cause: the assignee aggregation joins issue_assignees without filtering deleted_at IS NULL, and counts rows (Count("assignee_id")) instead of distinct work items. Every soft-deleted assignment (unassign/reassign, bulk edits, imports) is counted again. In this example there are 22 soft-deleted rows in the cycle, which is exactly 69 − 47.

Affected code (v1.4.2, same pattern still on preview): CycleAnalyticsEndpoint in apps/api/plane/app/views/cycle/base.py, and the equivalent assignee aggregations in cycle/archive.py, module/base.py and analytic/project_analytics.py.

What I expect: the breakdown counts only active assignments, one per distinct work item, matching the filtered list.

Steps to reproduce
  1. Create a cycle with a few work items.
  2. Assign a work item to user A, then unassign and reassign it a few times (each removal leaves a soft-deleted issue_assignees row).
  3. Open the cycle page and look at user A's count in the Assignees breakdown.
  4. Filter the cycle's work items by user A: the breakdown is higher.

SQL check: counting issue_assignees rows for the cycle and the user returns more rows than the same query with and ia.deleted_at is null.

Environment

Production

Browser

Other

Variant

Self-hosted

Version

v1.4.2

I have a fix with a regression test and will open a PR.

Lingua principale
TypeScript
Stelle
63k
Fork
6.5k
Merge medio
2g 16h
PR unite (30g)
70

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di makeplane/plane

Tutte le issue di makeplane/plane

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.