Fix nil comparsion and list conversion errors

account
Oleg Sovetnik 3 years ago committed by Viktor Baranov
parent 613b4dfddc
commit 25ee96d97a
  1. 1
      apps/explorer/lib/explorer/accounts/notify/notifier.ex
  2. 12
      apps/explorer/lib/explorer/accounts/notify/summary.ex

@ -118,6 +118,7 @@ defmodule Explorer.Accounts.Notify.Notifier do
method: summary.method,
block_number: summary.block_number,
amount: summary.amount,
subject: summary.subject,
tx_fee: summary.tx_fee,
name: summary.name,
type: summary.type

@ -83,6 +83,7 @@ defmodule Explorer.Accounts.Notify.Summary do
amount: amount(transaction),
tx_fee: fee(transaction),
name: Application.get_env(:explorer, :coin_name),
subject: "Coin transaction",
type: "COIN"
}
end
@ -104,6 +105,7 @@ defmodule Explorer.Accounts.Notify.Summary do
to_address_hash: transfer.to_address_hash,
block_number: transfer.block_number,
amount: amount(transfer),
subject: transfer.token.type,
tx_fee: fee(transaction),
name: transfer.token.name,
type: transfer.token.type
@ -131,7 +133,7 @@ defmodule Explorer.Accounts.Notify.Summary do
from_address_hash: transfer.from_address_hash,
to_address_hash: transfer.to_address_hash,
block_number: transfer.block_number,
subject: to_string(token_ids(transfer)),
subject: token_ids(transfer),
tx_fee: fee(transaction),
name: transfer.token.name,
type: transfer.token.type
@ -177,7 +179,13 @@ defmodule Explorer.Accounts.Notify.Summary do
end
def token_ids(%Chain.TokenTransfer{token_id: token_id, token_ids: token_ids}) do
token_id || token_ids
case token_id do
nil ->
Enum.map_join(token_ids, ", ", fn id -> to_string(id) end)
_ ->
to_string(token_id)
end
end
def token_decimals(%Chain.TokenTransfer{} = transfer) do

Loading…
Cancel
Save