fix(reports): zero-fill canonical project and asset status buckets #261

Merged
nrupard merged 1 commit from fix/pms-366-project-status-counters-zero-fill into main 2026-06-16 20:29:26 +02:00
Owner

The projects and clients reports built their status counters with a plain GROUP BY status, so a status with no rows produced no bucket at all. A tenant whose only projects are in Planning (the create form has no status field, so every new project is born "planning") loses the Planning bucket entirely, and the dashboard counters silently omit that state: a brand-new project counts toward nothing. The same gap applies to the asset state counter.

Zero-fill every canonical status from the relevant CHECK constraint so all states are always countable from the server. Projects fill planning/active/on_hold/completed/cancelled; assets fill active/inactive/retired/in_repair/in_stock. Any non-canonical status that somehow appears is preserved (sorted) after the canonical set, so the buckets still sum to the total rows. Tests assert every canonical bucket is present even at zero and that the buckets reconcile to the row total.

#PMS-366

The projects and clients reports built their status counters with a plain `GROUP BY status`, so a status with no rows produced no bucket at all. A tenant whose only projects are in Planning (the create form has no status field, so every new project is born "planning") loses the Planning bucket entirely, and the dashboard counters silently omit that state: a brand-new project counts toward nothing. The same gap applies to the asset state counter. Zero-fill every canonical status from the relevant CHECK constraint so all states are always countable from the server. Projects fill planning/active/on_hold/completed/cancelled; assets fill active/inactive/retired/in_repair/in_stock. Any non-canonical status that somehow appears is preserved (sorted) after the canonical set, so the buckets still sum to the total rows. Tests assert every canonical bucket is present even at zero and that the buckets reconcile to the row total. #PMS-366
fix(reports): zero-fill canonical project and asset status buckets
All checks were successful
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 56s
E2E / Playwright against staging (pull_request) Successful in 59s
Integration / integration tests (pull_request) Successful in 5m38s
Create release / Create release from merged PR (pull_request) Has been skipped
13b725239b
The projects and clients reports built their status counters with a plain `GROUP BY status`, so a status with no rows produced no bucket at all. A tenant whose only projects are in Planning (the create form has no status field, so every new project is born "planning") loses the Planning bucket entirely, and the dashboard counters silently omit that state: a brand-new project counts toward nothing. The same gap applies to the asset state counter.

Zero-fill every canonical status from the relevant CHECK constraint so all states are always countable from the server. Projects fill planning/active/on_hold/completed/cancelled; assets fill active/inactive/retired/in_repair/in_stock. Any non-canonical status that somehow appears is preserved (sorted) after the canonical set, so the buckets still sum to the total rows. Tests assert every canonical bucket is present even at zero and that the buckets reconcile to the row total.

#PMS-366
nrupard deleted branch fix/pms-366-project-status-counters-zero-fill 2026-06-16 20:29:26 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!261
No description provided.