fix(goals): round-3 review polish on PR #1798

- Demo seed_matched_pledge tie-breaks `entries.date DESC` with
  `entries.id DESC` so dense-same-day inflows pick the same row on
  every reseed
- projection_payload exposes the family-currency symbol via
  Money.new(0, currency).symbol; the chart's `_fmtMoneyShort` / fallback
  now reads it instead of the hardcoded $/€/£ map, so JPY/KRW/CHF
  goals get the correct glyph
This commit is contained in:
Guillem Arias
2026-05-15 07:41:23 +02:00
parent d6a12614a7
commit 15c5c7783e
3 changed files with 10 additions and 4 deletions

View File

@@ -562,13 +562,18 @@ export default class extends Controller {
maximumFractionDigits: 0,
}).format(amount);
} catch {
const symbol = currency === "EUR" ? "€" : currency === "GBP" ? "£" : "$";
// Same server-shipped symbol path as `_fmtMoneyShort`.
const symbol = (this.dataValue && this.dataValue.currency_symbol) || "$";
return `${symbol}${Math.round(amount).toLocaleString()}`;
}
}
_fmtMoneyShort(amount, currency) {
const symbol = currency === "EUR" ? "€" : currency === "GBP" ? "£" : "$";
_fmtMoneyShort(amount, _currency) {
// The server ships `currency_symbol` via projection_payload (resolved
// through Money.new(0, code).symbol so EUR/GBP/JPY/etc. render with
// the family-locale-correct glyph). Fall back to "$" if a stale
// payload reaches us mid-deploy.
const symbol = (this.dataValue && this.dataValue.currency_symbol) || "$";
const abs = Math.abs(amount);
if (abs >= 1_000_000) {
return `${symbol}${(amount / 1_000_000).toFixed(1).replace(/\.0$/, "")}M`;