mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 05:37:43 +01:00
* fix(create): a currency switch converts every amount instead of re-labelling it; prices start empty
Measured on orangecat.ch at 390px, dark and light, nothing submitted
(BTC at about CHF 60,600):
- Product: Price 25 CHF, then "Default Currency" set to BTC: the field
read 25 BTC; switched back to CHF it read 1515625.00.
- Loan: 10000 CHF and 8000 CHF; Loan Amount's switch to BTC gave
0.16494845 BTC next to a Remaining Balance of "8000 BTC".
- Price, Loan Amount and Remaining Balance showed "0.00": a tap and "25"
entered 0.0025 and read "0.00" on blur; 10000 entered 0.0010000.
- Asset: sale, rental and deposit prices were bare "(BTC)" number inputs;
the Rental Apartment template asked 0.025 BTC a day (about CHF 1,500).
- The currency select was an unnamed combobox: one on products, two on
loans, one on services, one on events.
What changed:
- The form converts every amount held in its currency when the currency
changes, from whichever control changed it, at today's rate and rounded
to what the field shows. Without a rate the switch is refused with a
message, never written as 0. A field's own switch no longer converts
only itself.
- Price, Loan Amount and Remaining Balance start empty and say "Enter a
price" / "Enter the loan amount" / "Enter the remaining balance" when
left empty. A fiat amount with more than two decimals is shown, not
rounded away.
- The asset's estimated value, sale, rental and deposit prices use the
same currency field as every other amount. The three *_btc prices are
stored in BTC (storedIn) and typed and shown in the form's currency.
Rental Apartment: 0.05 BTC a month, deposit 0.1 BTC.
- The product's "Default Currency" is "Currency" and says it converts
the price; the asset's Currency says the same of the estimated value.
- Every currency select is named after its field ("Price currency").
Claude-Session: https://claude.ai/code/session_019MDtmw3MnN44QwEv4M52CS
* fix(create): an amount keeps the unit it was typed in, and BTC prices round to what is stored
Review of #1677:
- The entry currency of a money field was worked out on every keystroke from
the live rate. A rate expiring mid-edit flipped it to the stored unit and the
whole typed string was read again in BTC: 30000 typed as CHF became 30000 BTC.
The unit is now fixed when the edit starts and released on blur or when the
owner switches currency.
- A converted amount is rounded to the stored unit's places (eight for BTC)
before it reaches the form, and the asset schema refuses a sale, rental or
deposit amount kept in BTC that rounds to 0.00000000 BTC.
Claude-Session: https://claude.ai/code/session_019MDtmw3MnN44QwEv4M52CS
---------
Co-authored-by: Claude <noreply@anthropic.com>