fix(reports): zero-fill canonical project and asset status buckets #261
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pms-366-project-status-counters-zero-fill"
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 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