fix new credo warnings

pull/2432/head
Ayrat Badykov 5 years ago
parent b01b4720d4
commit 26e35a6f21
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 40
      apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
  2. 7
      apps/block_scout_web/lib/block_scout_web/controllers/chain/market_history_chart_controller.ex

@ -83,10 +83,12 @@ defmodule BlockScoutWeb.AddressTransactionController do
unprocessable_entity(conn)
{:error, :not_found} ->
with {:ok, _} <- Chain.Hash.Address.validate(address_hash_string) do
json(conn, %{items: [], next_page_path: ""})
else
{:error, _} -> not_found(conn)
case Chain.Hash.Address.validate(address_hash_string) do
{:ok, _} ->
json(conn, %{items: [], next_page_path: ""})
{:error, _} ->
not_found(conn)
end
end
end
@ -113,20 +115,22 @@ defmodule BlockScoutWeb.AddressTransactionController do
{:ok, address_hash} = Chain.string_to_address_hash(address_hash_string)
address = %Chain.Address{hash: address_hash, smart_contract: nil, token: nil}
with {:ok, _} <- Chain.Hash.Address.validate(address_hash_string) do
render(
conn,
"index.html",
address: address,
coin_balance_status: nil,
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
filter: params["filter"],
transaction_count: 0,
validation_count: 0,
current_path: current_path(conn)
)
else
{:error, _} -> not_found(conn)
case Chain.Hash.Address.validate(address_hash_string) do
{:ok, _} ->
render(
conn,
"index.html",
address: address,
coin_balance_status: nil,
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
filter: params["filter"],
transaction_count: 0,
validation_count: 0,
current_path: current_path(conn)
)
{:error, _} ->
not_found(conn)
end
end
end

@ -5,7 +5,7 @@ defmodule BlockScoutWeb.Chain.MarketHistoryChartController do
alias Explorer.ExchangeRates.Token
def show(conn, _params) do
case ajax?(conn) do
if ajax?(conn) do
true ->
exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null()
@ -24,9 +24,8 @@ defmodule BlockScoutWeb.Chain.MarketHistoryChartController do
history_data: market_history_data,
supply_data: available_supply(Chain.supply_for_days(), exchange_rate)
})
_ ->
unprocessable_entity(conn)
else
unprocessable_entity(conn)
end
end

Loading…
Cancel
Save