fix(dashboard): derive real open/closed ticket counts for the Work card #175
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/dashboard-work-counters"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The project dashboard Work card reported 0 open / 0 closed while the
same page listed live tickets. Two causes:
OpenProjectClient::workPackageStatusGroups() parsed
_embedded.groups and _links.valueLink.href, but the real API v3
WorkPackageCollection renders groups as a TOP-LEVEL local property
(next to total) and each group's valueLink is a LINK LIST. Every
live call therefore produced an empty group list → 0/0 while
listWorkPackages (_embedded.elements) worked.
workSection() treated empty groups as real zeros instead of
falling back to a source that had already answered.
Client: read the top-level groups property (with an _embedded
fallback), accept valueLink as link list or single object, and
resolve a group's status through the catalog by id and, failing
that, by its display value — is_closed still drives every bucket.
Service: one listWorkPackages read now feeds both the recent slice
and the count fallback. The grouped collection is preferred for
exact totals; when it yields no groups the already-fetched list is
classified through listStatuses() is_closed metadata. When no
source can classify, the payload carries total/open/closed = null
with counts_unavailable (the card renders a note, never fake
zeros); counts_capped marks a lower bound when the scan saturates
its page. Sprint lookup failures degrade to 'no sprint shown'
instead of blanking the card.
Also: the work section cache key is now per user — the payload
embeds a native authorization decision and a project-wide key could
have served one authorized viewer's snapshot to the next user.