mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 15:59:02 +00:00
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:
@@ -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`;
|
||||
|
||||
Reference in New Issue
Block a user