Files
sure/app/models
Guillem Arias 62f8dc7514 fix(goals): current_balance guards against linked-account currency drift
Ruby idiom audit edge case. `linked_accounts.sum { |a| a.balance.to_d }`
trusted the model's validation that all linked accounts share the
goal's currency. The invariant holds at write-time, but direct DB
writes, an account-currency edit outside goal validation, or future
code that bypasses the validation chain could drift it. The naive
sum would silently add raw EUR + USD numbers and surface the result
as goal.currency.

Filter `linked_accounts.select { |a| a.currency == currency }` and
log/report-to-Sentry when the filtered count differs. The sum stays
correct (no FX, no mixing) and the operator gets visibility into
the drift.

Same pattern as `Family#savings_inflow_velocity` already uses for
the family-level rollup.
2026-05-14 21:59:48 +02:00
..
2025-03-28 13:08:22 -04: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-03-25 17:47:04 +01:00
2026-03-25 17:47:04 +01:00
2026-04-09 18:33:59 +02:00
2026-03-25 10:50:23 +01:00
2024-02-02 09:05:04 -06:00
2026-03-25 10:50:23 +01:00
2026-03-25 10:50:23 +01:00
2024-10-18 11:26:58 -05:00
2026-03-25 17:47:04 +01:00
2026-03-25 10:50:23 +01:00
2026-01-23 22:05:28 +01:00
2024-08-23 09:33:42 -04:00
2025-11-01 09:12:42 +01:00
2026-04-07 11:24:50 +02:00
2026-04-10 17:42:16 +02:00
2026-01-23 22:05:28 +01:00
2026-05-06 22:02:21 +02:00
2024-05-23 08:09:33 -04:00
2025-03-28 13:08:22 -04:00