Accurate Portfolio Stats on the Deduction Claims Page
Accurate Portfolio Stats on the Deduction Claims Page
Introduced in v0.1.143
Overview
The Deduction Claims index page displays a row of four summary stat cards at the top of the dashboard:
| Card | What it shows |
|---|---|
| Total Claims | Total number of deduction claims in the portfolio |
| In Progress | Claims currently being processed |
| Over-Deducting | Claims flagged as deducting more than is evidenced |
| Disputed | Claims where a formal dispute has been raised |
Prior to v0.1.143, these counts were derived from the current page of paginated results (page size: 25). On portfolios with more than 25 claims, the Over-Deducting and Disputed counts were partial — they reflected only the claims loaded on screen, not the full portfolio.
What Changed
As of v0.1.143, the summary stats are driven by two separate data sources:
- Total Claims — sourced from
data?.total, the server-side count returned alongside every paginated response. This was already accurate and remains unchanged. - In Progress, Over-Deducting, Disputed — now sourced from a dedicated
trpc.deductionClaims.statsquery that runs independently of pagination and aggregates counts across the entire portfolio on the server.
This means the stat cards are always an accurate, real-time snapshot of your full portfolio's health — regardless of which page you are viewing or how many total claims exist.
Why This Matters
Under the Renters' Rights Act, agents and landlords have a duty to handle deposit deductions fairly and transparently. Summary figures that underrepresent over-deductions or active disputes could cause compliance issues to go unnoticed. Accurate portfolio-wide stats ensure that nothing is hidden by pagination.
Notes for Developers
- The
trpc.deductionClaims.statsendpoint returns portfolio-wide aggregated status counts and is independent of the paginatedtrpc.deductionClaims.listquery. - Both queries run in parallel on page load — there is no additional waterfall latency.
- If you are extending the stats row with additional status types, add the new status to the server-side aggregation in
deductionClaims.statsrather than deriving it from the paginatedreleasesarray on the client.