mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Prepare fixture data for account sync tests (#493)
* Rename account balance field for clarity `original_balance` and `original_currency` may infer that these values are "original" to the account. In reality, they represent the "current" balance and currency on the account. * Prepare fixture data for account sync testing * Update to new field * Fix conflicts * Remove local schema change
This commit is contained in:
parent
d3b326d273
commit
7d48c01833
37 changed files with 230 additions and 265 deletions
|
@ -37,11 +37,11 @@ class Account < ApplicationRecord
|
|||
end
|
||||
|
||||
def check_currency
|
||||
if self.original_currency == self.family.currency
|
||||
self.converted_balance = self.original_balance
|
||||
self.converted_currency = self.original_currency
|
||||
if self.currency == self.family.currency
|
||||
self.converted_balance = self.balance
|
||||
self.converted_currency = self.currency
|
||||
else
|
||||
self.converted_balance = ExchangeRate.convert(self.original_currency, self.family.currency, self.original_balance)
|
||||
self.converted_balance = ExchangeRate.convert(self.currency, self.family.currency, self.balance)
|
||||
self.converted_currency = self.family.currency
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue