parent
37b7f11b79
commit
fc513ccb91
@ -1,8 +1,13 @@ |
||||
defmodule Explorer.AddressForm do |
||||
@moduledoc false |
||||
|
||||
alias Explorer.Credit |
||||
alias Explorer.Debit |
||||
|
||||
def build(address) do |
||||
balance = Decimal.sub(address.credit.value, address.debit.value) |
||||
credit = address.credit || Credit.null |
||||
debit = address.debit || Debit.null |
||||
balance = Decimal.sub(credit.value, debit.value) |
||||
Map.put(address, :balance, balance) |
||||
end |
||||
end |
||||
|
Loading…
Reference in new issue