Mikael
cc20e2c19c
Fix foreign currency accounts using wrong exchange rate in balance sheet totals ( #1010 )
...
Balance sheet totals and accountable type summaries used a SQL JOIN on
exchange_rates matching only today's date, which returned NULL (defaulting
to 1:1) when no rate existed for that exact date. This caused foreign
currency accounts to show incorrect totals.
Changes:
- Refactor BalanceSheet::AccountTotals to batch-fetch exchange rates via
ExchangeRate.rates_for, with provider fallback, instead of a SQL join
- Refactor Accountable.balance_money to use the same batch approach
- Add ExchangeRate.rates_for helper for deduplicated rate lookups
- Fix net worth chart query to fall back to the nearest future rate when
no historical rate exists for a given date
- Add composite index on accounts (family_id, status, accountable_type)
- Reuse nearest cached exchange rate within a 5-day lookback window
before calling the provider, preventing redundant API calls on
weekends and holidays when providers return prior-day rates
https://claude.ai/code/session_01GyssBJxQqdWnuYofQRjUu8
Co-authored-by: Claude <noreply@anthropic.com >
2026-02-19 18:07:47 +01:00
..
2026-02-01 23:48:54 +01:00
2026-02-11 15:22:56 +01:00
2026-02-19 18:07:47 +01:00
2026-02-19 18:07:47 +01:00
2025-03-28 13:08:22 -04:00
2026-01-21 22:56:39 +01:00
2026-01-21 22:56:39 +01:00
2026-01-07 15:59:04 +01:00
2026-01-07 15:59:04 +01:00
2026-01-22 22:23:09 +01:00
2026-02-19 18:07:47 +01:00
2026-02-09 11:09:25 +01:00
2026-01-18 15:11:34 +01:00
2025-11-29 13:31:08 +01:00
2026-01-18 15:11:34 +01:00
2026-02-06 18:04:03 +01:00
2026-02-19 18:07:47 +01:00
2026-02-11 17:34:53 +00:00
2026-02-06 18:30:50 +01:00
2026-01-23 22:12:02 +01:00
2026-02-16 13:50:06 +01:00
2026-02-08 18:19:37 +01:00
2026-02-08 18:19:37 +01:00
2026-01-09 13:03:40 +01:00
2026-01-12 15:35:14 -05:00
2026-02-01 23:48:54 +01:00
2026-01-23 00:53:24 +01:00
2026-01-09 19:38:04 +01:00
2026-01-22 20:37:07 +01:00
2026-01-22 20:37:07 +01:00
2026-01-22 20:37:07 +01:00
2026-02-07 16:41:31 +01:00
2026-01-10 20:11:00 +01:00
2026-01-24 11:16:26 +01:00
2026-02-08 18:19:37 +01:00
2025-12-17 16:03:05 +01:00
2026-02-16 14:01:28 +01:00
2026-01-27 15:45:50 +01:00
2026-01-05 22:11:47 +01:00
2026-01-20 07:44:12 +01:00
2026-01-16 12:34:06 +01:00
2026-01-22 22:23:09 +01:00
2026-01-23 00:28:17 +01:00
2026-01-23 08:55:34 +01:00
2025-10-22 16:02:50 +02:00
2026-01-16 21:04:10 +01:00
2026-02-16 13:50:06 +01:00
2026-01-20 17:51:36 -05:00
2025-07-15 11:42:41 -04:00
2026-02-11 15:22:56 +01:00
2026-01-22 15:25:43 +01:00
2025-08-11 22:58:44 +02:00
2026-01-07 15:59:04 +01:00
2026-02-13 19:30:29 +01:00
2025-04-16 20:26:45 -05:00
2026-02-06 21:25:52 +01:00
2024-02-02 09:05:04 -06:00
2025-04-01 07:21:54 -04:00
2025-10-24 12:04:19 +02:00
2025-12-24 00:15:53 +01:00
2025-08-11 22:58:44 +02:00
2025-07-23 18:15:14 -04:00
2026-01-21 22:10:15 +01:00
2026-02-04 23:58:09 +01:00
2026-01-10 16:39:18 +01:00
2026-02-15 10:33:51 +01:00
2025-10-24 12:04:19 +02:00
2026-02-04 23:40:01 +01:00
2026-02-10 23:42:22 +01:00
2026-02-04 23:40:01 +01:00
2026-02-10 23:42:22 +01:00
2025-05-23 18:58:22 -04:00
2026-01-21 22:56:39 +01:00
2024-10-18 11:26:58 -05:00
2026-02-08 18:19:37 +01:00
2025-05-23 18:58:22 -04:00
2025-04-01 07:21:54 -04:00
2026-01-23 22:05:28 +01:00
2026-02-10 23:42:22 +01:00
2026-02-01 23:48:54 +01:00
2026-02-06 14:11:46 +01:00
2025-07-03 09:33:07 -04:00
2025-03-17 11:54:53 -04:00
2026-02-11 15:22:56 +01:00
2025-09-24 00:19:51 +02:00
2026-01-09 19:38:04 +01:00
2026-01-21 17:16:51 +01:00
2026-02-15 10:33:51 +01:00
2026-02-06 18:30:50 +01:00
2024-10-18 11:26:58 -05:00
2024-10-18 11:26:58 -05:00
2026-01-30 20:44:25 +01:00
2026-01-10 20:26:08 +01:00
2026-02-08 18:19:37 +01:00
2026-02-10 23:42:22 +01:00
2026-01-16 21:04:10 +01:00
2026-01-11 23:58:51 +01:00
2026-01-19 15:44:49 +01:00
2026-02-09 11:09:25 +01:00
2026-01-23 22:05:28 +01:00
2025-11-22 02:15:20 +01:00
2025-05-23 18:58:22 -04:00
2026-01-23 22:05:28 +01:00
2026-02-10 23:42:22 +01:00
2025-11-20 19:50:22 +01:00
2024-08-23 09:33:42 -04:00
2025-11-01 09:12:42 +01:00
2026-02-04 23:40:01 +01:00
2026-02-10 23:42:22 +01:00
2025-04-01 07:21:54 -04:00
2026-01-10 16:39:18 +01:00
2026-02-06 18:04:29 +01:00
2026-01-03 17:56:42 -05:00
2025-02-21 11:57:59 -05:00
2025-02-21 11:57:59 -05:00
2026-02-16 21:11:41 +01:00
2026-02-04 23:58:09 +01:00
2026-01-24 11:16:26 +01:00
2026-02-10 23:42:22 +01:00
2025-07-03 09:33:07 -04:00
2026-02-08 18:19:37 +01:00
2025-05-15 10:19:56 -04:00
2025-12-17 16:03:05 +01:00
2025-04-14 11:40:34 -04:00
2026-01-10 16:39:18 +01:00
2025-12-07 16:30:02 +01:00
2026-02-13 19:53:24 +01:00
2026-01-27 15:45:50 +01:00
2025-11-20 08:31:03 +01:00
2026-01-23 22:05:28 +01:00
2026-01-26 09:46:20 +01:00
2026-01-23 22:05:28 +01:00
2026-02-10 23:42:22 +01:00
2026-02-04 23:40:01 +01:00
2026-02-10 23:42:22 +01:00
2026-01-03 17:56:42 -05:00
2026-02-06 18:04:03 +01:00
2026-02-10 23:14:58 +01:00
2026-01-23 18:55:51 +01:00
2025-11-25 20:21:29 +01:00
2025-04-14 11:40:34 -04:00
2024-05-23 08:09:33 -04:00
2025-03-28 13:08:22 -04:00
2026-01-16 21:04:10 +01:00
2026-01-20 00:01:55 +01:00
2026-01-16 12:34:06 +01:00
2026-02-16 13:50:06 +01:00
2026-01-12 15:35:14 -05:00
2025-02-21 11:57:59 -05:00
2025-04-01 07:21:54 -04:00
2026-02-09 11:09:25 +01:00
2025-07-15 11:42:41 -04:00
2026-02-11 15:22:56 +01:00
2025-04-14 11:40:34 -04:00