mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Fix foreign account sync crash (#794)
* Fix foreign account sync crash * Refactor synth provider and show UI error if not configured * Generate error message on missing exchange rates while converting balances * Ignore sync messaged in i18n-tasks unused * Generate missing exchange rate error during entry normalization * Update alert classes
This commit is contained in:
parent
e9c8897eaf
commit
483d67846c
12 changed files with 102 additions and 45 deletions
|
@ -12,11 +12,11 @@ class ExchangeRate < ApplicationRecord
|
|||
end
|
||||
|
||||
def find_rate_or_fetch(from:, to:, date:)
|
||||
find_rate(from:, to:, date:) || fetch_rate_from_provider(from:, to:, date:).tap(&:save!)
|
||||
find_rate(from:, to:, date:) || fetch_rate_from_provider(from:, to:, date:)&.tap(&:save!)
|
||||
end
|
||||
|
||||
def get_rate_series(from, to, date_range)
|
||||
where(base_currency: from, converted_currency: to, date: date_range).order(:date)
|
||||
def get_rates(from, to, dates)
|
||||
where(base_currency: from, converted_currency: to, date: dates).order(:date)
|
||||
end
|
||||
|
||||
def convert(value:, from:, to:, date:)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue