fix: fix to/from filters on tx list pages

pull/2017/head
zachdaniel 6 years ago
parent c2c5880296
commit 6a065bf20e
  1. 1
      CHANGELOG.md
  2. 4
      apps/explorer/lib/explorer/chain/token_transfer.ex
  3. 8
      apps/explorer/test/explorer/chain/token_transfer_test.exs

@ -58,6 +58,7 @@
- [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block - [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block
- [#1992](https://github.com/poanetwork/blockscout/pull/1992) - fix: support https for wobserver polling - [#1992](https://github.com/poanetwork/blockscout/pull/1992) - fix: support https for wobserver polling
- [#1966](https://github.com/poanetwork/blockscout/pull/1966) - fix: add fields for contract filter performance - [#1966](https://github.com/poanetwork/blockscout/pull/1966) - fix: add fields for contract filter performance
- [#2017](https://github.com/poanetwork/blockscout/pull/2017) - fix: fix to/from filters on tx list pages
### Chore ### Chore

@ -175,7 +175,7 @@ defmodule Explorer.Chain.TokenTransfer do
from( from(
tt in TokenTransfer, tt in TokenTransfer,
where: tt.to_address_hash == ^address_hash, where: tt.to_address_hash == ^address_hash,
select: tt.transaction_hash select: type(tt.transaction_hash, :binary)
) )
query query
@ -189,7 +189,7 @@ defmodule Explorer.Chain.TokenTransfer do
from( from(
tt in TokenTransfer, tt in TokenTransfer,
where: tt.from_address_hash == ^address_hash, where: tt.from_address_hash == ^address_hash,
select: tt.transaction_hash select: type(tt.transaction_hash, :binary)
) )
query query

@ -247,9 +247,11 @@ defmodule Explorer.Chain.TokenTransferTest do
amount: 1 amount: 1
) )
{:ok, transaction_bytes} = Explorer.Chain.Hash.Full.dump(transaction.hash)
transactions_hashes = TokenTransfer.where_any_address_fields_match(:to, paul.hash, %PagingOptions{page_size: 1}) transactions_hashes = TokenTransfer.where_any_address_fields_match(:to, paul.hash, %PagingOptions{page_size: 1})
assert Enum.member?(transactions_hashes, transaction.hash) == true assert Enum.member?(transactions_hashes, transaction_bytes) == true
end end
test "when from_address_hash match returns transactions hashes list" do test "when from_address_hash match returns transactions hashes list" do
@ -283,9 +285,11 @@ defmodule Explorer.Chain.TokenTransferTest do
amount: 1 amount: 1
) )
{:ok, transaction_bytes} = Explorer.Chain.Hash.Full.dump(transaction.hash)
transactions_hashes = TokenTransfer.where_any_address_fields_match(:from, john.hash, %PagingOptions{page_size: 1}) transactions_hashes = TokenTransfer.where_any_address_fields_match(:from, john.hash, %PagingOptions{page_size: 1})
assert Enum.member?(transactions_hashes, transaction.hash) == true assert Enum.member?(transactions_hashes, transaction_bytes) == true
end end
test "when to_from_address_hash or from_address_hash match returns transactions hashes list" do test "when to_from_address_hash or from_address_hash match returns transactions hashes list" do

Loading…
Cancel
Save