Fixup test cases

pull/1040/head
svenski123 6 years ago
parent 20543a2ca0
commit ae9f4140ea
  1. 4
      apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs
  2. 3
      apps/explorer/lib/explorer/chain.ex

@ -10,7 +10,9 @@ defmodule BlockScoutWeb.AddressControllerTest do
conn = get(conn, address_path(conn, :index)) conn = get(conn, address_path(conn, :index))
assert conn.assigns.addresses |> Enum.map(& &1.hash) == address_hashes assert conn.assigns.address_tx_count_pairs
|> Enum.map(fn {address, _transaction_count} -> address end)
|> Enum.map(& &1.hash) == address_hashes
end end
end end

@ -923,7 +923,7 @@ defmodule Explorer.Chain do
@spec list_top_addresses :: [{Address.t(), non_neg_integer()}] @spec list_top_addresses :: [{Address.t(), non_neg_integer()}]
def list_top_addresses do def list_top_addresses do
query = query =
from a in Address, from(a in Address,
left_join: t in Transaction, left_join: t in Transaction,
on: a.hash == t.from_address_hash, on: a.hash == t.from_address_hash,
where: a.fetched_coin_balance > ^0, where: a.fetched_coin_balance > ^0,
@ -931,6 +931,7 @@ defmodule Explorer.Chain do
order_by: [desc: a.fetched_coin_balance, asc: a.hash], order_by: [desc: a.fetched_coin_balance, asc: a.hash],
select: {a, fragment("coalesce(1 + max(?), 0)", t.nonce)}, select: {a, fragment("coalesce(1 + max(?), 0)", t.nonce)},
limit: 250 limit: 250
)
Repo.all(query) Repo.all(query)
end end

Loading…
Cancel
Save