fix cr issues

pull/2432/head
Ayrat Badykov 5 years ago
parent 1465f6d2fc
commit 8f92a1f720
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 46
      apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex
  2. 21
      apps/indexer/lib/indexer/fetcher/internal_transaction.ex

@ -6,32 +6,30 @@ defmodule BlockScoutWeb.RecentTransactionsController do
alias Phoenix.View
def index(conn, _params) do
case ajax?(conn) do
true ->
recent_transactions =
Chain.recent_collated_transactions(
necessity_by_association: %{
:block => :required,
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional
},
paging_options: %PagingOptions{page_size: 5}
)
if ajax?(conn) do
recent_transactions =
Chain.recent_collated_transactions(
necessity_by_association: %{
:block => :required,
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional
},
paging_options: %PagingOptions{page_size: 5}
)
transactions =
Enum.map(recent_transactions, fn transaction ->
%{
transaction_hash: Hash.to_string(transaction.hash),
transaction_html:
View.render_to_string(BlockScoutWeb.TransactionView, "_tile.html", transaction: transaction)
}
end)
transactions =
Enum.map(recent_transactions, fn transaction ->
%{
transaction_hash: Hash.to_string(transaction.hash),
transaction_html:
View.render_to_string(BlockScoutWeb.TransactionView, "_tile.html", transaction: transaction)
}
end)
json(conn, %{transactions: transactions})
_ ->
unprocessable_entity(conn)
json(conn, %{transactions: transactions})
else
unprocessable_entity(conn)
end
end
end

@ -205,15 +205,18 @@ defmodule Indexer.Fetcher.InternalTransaction do
{hash, block_number}
end)
case Chain.import(%{
addresses: %{params: addresses_params},
internal_transactions: %{params: internal_transactions_params_without_failed_creations},
internal_transactions_indexed_at_blocks: %{
params: internal_transactions_indexed_at_blocks,
with: :number_only_changeset
},
timeout: :infinity
}) do
imports =
Chain.import(%{
addresses: %{params: addresses_params},
internal_transactions: %{params: internal_transactions_params_without_failed_creations},
internal_transactions_indexed_at_blocks: %{
params: internal_transactions_indexed_at_blocks,
with: :number_only_changeset
},
timeout: :infinity
})
case imports do
{:ok, imported} ->
async_import_coin_balances(imported, %{
address_hash_to_fetched_balance_block_number: address_hash_to_block_number

Loading…
Cancel
Save