fix(display): uniform currency, billing-cycle label, resolved audit-log diff #229
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-365-display-formatting-sweep"
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?
What
PMS-365 display-correctness sweep (external review #2, findings #8 + #9). Three areas: uniform currency, enum labels, and resolved audit-log diff.
Root cause for all three: shared helpers already exist (
utils/money.rsfrom MAPPS-197; manyhumanize_*enum helpers), but a handful of ad-hoc render sites bypassed them, and the audit-log diff dumped raw JSON. This routes every flagged site through a helper.1. Currency (AC #1) - 9 sites routed to the shared formatter
format!("${total_value:.0}")->$25000format_money_f64->$25,000.00"${remaining:.0}"->$25000format_money_f64format!("${}", ...)format_money_strformat!("${}", a.total)format_money_str/ Actualformat!("${:.0}", pf(...))format_money_strformat!("${rate}")format_money_strFixes the reviewer's same-flow mismatch (Total Budget stat / Remaining showed
$25000next to a correctly formatted$25,000.00card).2. Enum label (AC #2) - 1 gap
Added
humanize_billing_cycle(mirrorshumanize_contract_type/humanize_contract_status) and applied it on the contract detail panel:monthly->Monthly. Every other user-facing enum already passes through ahumanize_*helper (tickets, contract type/status, invoice status, payment method, tenant status, plan, provider, KB visibility).3. Audit-log diff (AC #3) - FK resolution + humanized labels
Replaced the two raw
old_values/new_valuesJSON blobs with a field-by-field "Changes" view:project_manager_id-> "Project manager" (trailing_iddropped, sentence-cased)./auth/userslist the project pickers use; unresolved ids fall back to a short UUID prefix; null/empty render as(empty). SoProject manager id: (empty) -> (reference)now readsProject manager: (empty) -> Jane Doe.Seven unit tests cover the pure helpers (key humanization, FK resolve, unknown-FK fallback, null/empty, non-user-FK passthrough, key union order, non-object fallback).
Scope notes (AC #4 audit)
portal.rskeeps its ownportal_moneyon the separate client-portal surface; folding it into the shared helper is left out of this sweep.status: in_progresschange) render literally; per-field enum humanization in the generic diff is out of scope (no per-field enum map).Verification
cargo fmt --all --checkcargo clippy --target wasm32-unknown-unknown -- -D warningscleancargo test --lib audit-> 7 passed🤖 Generated with Claude Code