1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Add multi currency demo accounts (#530)

This commit is contained in:
Zach Gollwitzer 2024-03-07 17:46:36 -05:00 committed by GitHub
parent 90d0cc0c39
commit ed89ad522d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 72 additions and 9 deletions

View file

@ -3,6 +3,12 @@ class ExchangeRate < ApplicationRecord
return amount unless EXCHANGE_RATE_ENABLED
rate = ExchangeRate.find_by(base_currency: from, converted_currency: to)
amount * rate.rate
# TODO: Handle the case where the rate is not found
if rate.nil?
amount # Silently handle the error by returning the original amount
else
amount * rate.rate
end
end
end