|
|
@ -6,7 +6,7 @@ defmodule Explorer.Chain.Statistics do |
|
|
|
import Ecto.Query |
|
|
|
import Ecto.Query |
|
|
|
|
|
|
|
|
|
|
|
alias Ecto.Adapters.SQL |
|
|
|
alias Ecto.Adapters.SQL |
|
|
|
alias Explorer.{Chain, Repo} |
|
|
|
alias Explorer.{Chain, PagingOptions, Repo} |
|
|
|
alias Explorer.Chain.{Block, Transaction} |
|
|
|
alias Explorer.Chain.{Block, Transaction} |
|
|
|
alias Timex.Duration |
|
|
|
alias Timex.Duration |
|
|
|
|
|
|
|
|
|
|
@ -115,13 +115,9 @@ defmodule Explorer.Chain.Statistics do |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
transactions = |
|
|
|
transactions = |
|
|
|
from( |
|
|
|
[paging_options: %PagingOptions{page_size: 5}] |
|
|
|
transaction in Transaction, |
|
|
|
|> Chain.recent_collated_transactions() |
|
|
|
join: block in assoc(transaction, :block), |
|
|
|
|> Repo.preload([:block]) |
|
|
|
order_by: [desc: block.number], |
|
|
|
|
|
|
|
preload: [:from_address, :to_address, block: block], |
|
|
|
|
|
|
|
limit: 5 |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%__MODULE__{ |
|
|
|
%__MODULE__{ |
|
|
|
average_time: query_duration(@average_time_query), |
|
|
|
average_time: query_duration(@average_time_query), |
|
|
@ -130,7 +126,7 @@ defmodule Explorer.Chain.Statistics do |
|
|
|
lag: query_duration(@lag_query), |
|
|
|
lag: query_duration(@lag_query), |
|
|
|
transaction_count: query_value(@transaction_count_query), |
|
|
|
transaction_count: query_value(@transaction_count_query), |
|
|
|
transaction_velocity: query_value(@transaction_velocity_query), |
|
|
|
transaction_velocity: query_value(@transaction_velocity_query), |
|
|
|
transactions: Repo.all(transactions) |
|
|
|
transactions: transactions |
|
|
|
} |
|
|
|
} |
|
|
|
|> put_max_numbered_block() |
|
|
|
|> put_max_numbered_block() |
|
|
|
end |
|
|
|
end |
|
|
|