transactions: never print a foreign amount as AUD
ci / lint-test (push) Successful in 48s

The amount cell rendered formatAmount(amount_aud ?? amount) with no currency
argument, so a row with no AUD figure fell back to its native amount and was
stamped with a dollar sign. A USD 10,782.00 Wise credit showed as "+$10,782.00"
in a column of AUD figures — the same payment from the statement, one row above,
correctly showed $15,518.53 over USD 10,782.00. So the feed row read as $10,782
AUD when the real value is about $15,500, and the sub-line just repeated the
same number correctly labelled.

amount_unconverted is already selected by the transactions query (queries.ts:298)
and was simply unused here. When set, the native figure becomes the headline and
the absence of a rate is stated rather than papered over.

Pre-existing rather than Frollo's: any row with amount_aud NULL and a foreign
currency hits it, including foreign order-receipt rows. Frollo made it visible
at scale — 39 rows.
This commit is contained in:
2026-08-13 12:32:17 +10:00
parent 2738213a23
commit afd75d3f09
+21
View File
@@ -1059,12 +1059,33 @@ function TransactionsContent() {
<td className={`p-2 text-right whitespace-nowrap font-mono ${ <td className={`p-2 text-right whitespace-nowrap font-mono ${
SPEND_TYPES.has(t.transaction_type) ? "text-red-400" : "text-green-400" SPEND_TYPES.has(t.transaction_type) ? "text-red-400" : "text-green-400"
}`}> }`}>
{/*
A row with no AUD figure must NOT be printed as AUD.
`amount_aud ?? amount` formatted with the default currency
rendered a USD 10,782.00 Wise credit as "+$10,782.00" in a
column of AUD figures — the real value was about $15,500,
and the row directly above it (the same payment from the
statement) showed exactly that. The native figure is the
only true one here, so it becomes the headline and the
absence of a rate is stated rather than papered over.
*/}
{t.amount_unconverted ? (
<>
{formatAmount(t.amount, t.transaction_type, t.currency)}
<div className="text-[10px] text-zinc-500 mt-0.5" title="No AUD figure exists for this row — it is excluded from AUD totals">
no AUD rate
</div>
</>
) : (
<>
{formatAmount(t.amount_aud ?? t.amount, t.transaction_type)} {formatAmount(t.amount_aud ?? t.amount, t.transaction_type)}
{t.currency && t.currency !== "AUD" && ( {t.currency && t.currency !== "AUD" && (
<div className="text-[10px] text-zinc-500 mt-0.5"> <div className="text-[10px] text-zinc-500 mt-0.5">
{formatAmount(t.amount, t.transaction_type, t.currency)} {formatAmount(t.amount, t.transaction_type, t.currency)}
</div> </div>
)} )}
</>
)}
</td> </td>
<td className="p-2"> <td className="p-2">
<EditableTypeBadge <EditableTypeBadge