Move internal transaction type comparison out of fragment

Co-authored-by: Igor Florian <igor.florian@plataformatec.com.br>
pull/221/head
Tim Mecklem 7 years ago
parent c3a7705d47
commit 2ff420a097
  1. 17
      apps/explorer/lib/explorer/chain.ex

@ -1855,15 +1855,18 @@ defmodule Explorer.Chain do
end
defp where_transaction_has_multiple_internal_transactions(query) do
query
|> where(
[it, transaction],
where(
query,
[internal_transaction, transaction],
internal_transaction.type != ^:call or
fragment(
"(? != ? OR (SELECT COUNT(sibling.id) FROM internal_transactions as sibling WHERE sibling.transaction_hash = ?) > 1)",
it.type,
"call",
"""
(SELECT COUNT(sibling.id)
FROM internal_transactions AS sibling
WHERE sibling.transaction_hash = ?)
""",
transaction.hash
)
) > 1
)
end
end

Loading…
Cancel
Save