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

Add test cases for multi-currency investment syncing

This commit is contained in:
Zach Gollwitzer 2024-08-13 16:32:07 -04:00
parent 0691041d37
commit 993be6615a
5 changed files with 101 additions and 23 deletions

View file

@ -200,6 +200,11 @@ class Account::Entry < ApplicationRecord
end
def trade_valid?
if account_trade.currency != currency
# i18n-tasks-use t('activerecord.errors.models.account/entry.attributes.base.currency_mismatch')
errors.add(:base, :currency_mismatch)
end
if account_trade.sell?
current_qty = account.holding_qty(account_trade.security)