refactor(ui): consolidate money formatting into one shared helper (MAPPS-197) #175
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/MAPPS-197-money-format"
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
Consolidate currency formatting into one shared helper. Projects, billing, and contracts each had their own money formatter, so the same amount rendered three different ways:
fmt_money(f64):$60000(no separators, no cents)money(raw server string):$60000.00(no separators)format_money(Decimal):$60,000.00(correct)Change
crate::utils::moneymodule is the single source of truth:format_money(Decimal)/format_money_opt(Option<Decimal>)(the grouped-thousands, two-decimal logic promoted from contracts), plusformat_money_f64(Option<f64>)andformat_money_str(&str)adapters for the projects (f64) and billing (server-string) call sites.fmt_money(projects) andmoney(billing) helpers are removed; contracts imports the shared functions (call sites unchanged).$60,000.00consistently.Testing (rust-builder container, matches CI)
cargo test --lib: 3 newutils::moneytests pass (grouping, negatives/zero, the opt/f64/str adapters).cargo clippy --all-targets -- -D warnings: clean.cargo check --target wasm32-unknown-unknown: clean.cargo fmt --all --check: clean.