From 67e0e3c3339552df2073a261755d95512cf2f1c5 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 5 Nov 2019 13:40:30 +0300 Subject: [PATCH] select distinct token transfers by transaction hash --- .../controllers/address_token_transfer_controller.ex | 1 - apps/explorer/lib/explorer/chain/token_transfer.ex | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex index 1be7a9c8c0..c67055c3e2 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex @@ -170,7 +170,6 @@ defmodule BlockScoutWeb.AddressTokenTransferController do ) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash) do - render( conn, "index.html", diff --git a/apps/explorer/lib/explorer/chain/token_transfer.ex b/apps/explorer/lib/explorer/chain/token_transfer.ex index 900a57e759..b6171219bf 100644 --- a/apps/explorer/lib/explorer/chain/token_transfer.ex +++ b/apps/explorer/lib/explorer/chain/token_transfer.ex @@ -215,7 +215,8 @@ defmodule Explorer.Chain.TokenTransfer do from( tt in TokenTransfer, where: tt.to_address_hash == ^address_hash, - select: type(tt.transaction_hash, :binary) + select: type(tt.transaction_hash, :binary), + distinct: tt.transaction_hash ) query @@ -229,7 +230,8 @@ defmodule Explorer.Chain.TokenTransfer do from( tt in TokenTransfer, where: tt.from_address_hash == ^address_hash, - select: type(tt.transaction_hash, :binary) + select: type(tt.transaction_hash, :binary), + distinct: tt.transaction_hash ) query @@ -249,6 +251,7 @@ defmodule Explorer.Chain.TokenTransfer do from(token_transfer in TokenTransfer, where: token_transfer.to_address_hash == ^address_bytes or token_transfer.from_address_hash == ^address_bytes, select: type(token_transfer.transaction_hash, :binary), + distinct: token_transfer.transaction_hash, limit: ^page_size )