add6e982a4
Before this change, every claim — matched or not — came back from `/api/claims` with `receivedAmount: 0.0`. `to_ui_claim_from_orm` hardcoded the value, so the Dashboard's 'Received' KPI and the claim detail drawer's paid amount always read $0 regardless of whether the claim had been paired with a paying remittance. The fix threads the real value through the read path: - `to_ui_claim_from_orm` accepts a new `received_total: float` kwarg (default 0.0 for callers that don't have a remittance in scope). - `iter_claims` bulk-loads `Remittance.total_paid` for every matched claim id in the result set (single SQL roundtrip via `IN` filter — no N+1) and stamps the sum onto each claim dict. - `manual_match` passes `float(remit.total_paid)` from the remit it's already holding. - `manual_unmatch` reads `paired_remit.total_paid` before clearing the FK so the response still reports what was paid pre-unpair. - `add` (write path) and `list_unmatched` (filters matched-remit is NULL) pass `0.0` explicitly for readability. The dev seed CLI now also generates matched Remittance rows for every PAID/PARTIAL claim — `matched_remittance_id` is set on the claim, and the remittance's `total_paid` is derived from the billed amount using the same ratios the frontend's old sample fixtures used (60–100% for PAID, 20–50% for PARTIAL). That gives the Dashboard a non-zero 'Received' KPI on a fresh dev DB. New tests: - tests/test_iter_claims_received.py — 4 cases covering matched, unmatched, orphan FK, and bulk-load paths. Catches regressions if anyone re-introduces the hardcoded 0.0 or breaks the bulk query.