CourtProfile.stx:33-46 shows fixed placeholder stats: "Active Judges: 24, Total Reviews: 1287, Avg Rating: 4.4, Cases / yr: 12k". Hardcoded across every courthouse. Looks impressive on first glance, false on second.
Scope
- Replace hardcoded values with derived stats per courthouse:
- Active judges:
Judge.where('court_house_id', id).count(). - Total reviews: count of published reviews on judges at this court.
- Average rating: mean of published reviews on judges at this court.
- Cases / yr: drop (or replace with something we can actually compute; the value isn't in any table today).
- Active judges:
- API: extend
CourtHouseShowActionto compute + return these. - Surface in
CourtProfile.stxvia real:textbindings instead of hardcoded numbers. - Cache the aggregates per courthouse with a short TTL (5 min) since they change slowly.
Acceptance
- Each courthouse profile shows real numbers tied to that court's reality.
- A new courthouse with zero reviewed judges shows "0 / 0 / —" cleanly.
- "Cases / yr" either becomes real (if we add the data) or is removed; no more fake number.
Files to touch
app/Actions/CourtHouses/CourtHouseShowAction.tsresources/components/Bench/Court/CourtProfile.stx:33-46