From 9adad92d71e9d6edf498f23c6ff30a796a8f46ec Mon Sep 17 00:00:00 2001 From: Tim Mecklem Date: Tue, 26 Jun 2018 09:20:28 -0400 Subject: [PATCH] Remove unused transaction count query --- apps/explorer/lib/explorer/chain/statistics.ex | 11 ----------- .../test/explorer/chain/statistics_test.exs | 18 ------------------ 2 files changed, 29 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/statistics.ex b/apps/explorer/lib/explorer/chain/statistics.ex index 2a09b864af..5dc8d3ecee 100644 --- a/apps/explorer/lib/explorer/chain/statistics.ex +++ b/apps/explorer/lib/explorer/chain/statistics.ex @@ -20,13 +20,6 @@ defmodule Explorer.Chain.Statistics do ) t """ - @transaction_count_query """ - SELECT count(transactions.hash) - FROM transactions - JOIN blocks ON blocks.hash = transactions.block_hash - WHERE blocks.timestamp > NOW() - interval '1 day' - """ - @lag_query """ SELECT coalesce(avg(lag), interval '0 seconds') FROM ( @@ -69,7 +62,6 @@ defmodule Explorer.Chain.Statistics do * `number` - the latest `t:Explorer.Chain.Block.t/0` `number` `t:Explorer.Chain.Block.t/0` * `timestamp` - when the last `t:Explorer.Chain.Block.t/0` was mined/validated - * `transaction_count` - the number of transactions confirmed in blocks that were mined/validated in the last day * `transaction_velocity` - the number of `t:Explorer.Chain.Block.t/0` mined/validated in the last minute * `transactions` - the last <= 5 `t:Explorer.Chain.Transaction.t/0` """ @@ -80,7 +72,6 @@ defmodule Explorer.Chain.Statistics do lag: Duration.t(), number: Block.block_number(), timestamp: :calendar.datetime(), - transaction_count: non_neg_integer(), transaction_velocity: transactions_per_minute(), transactions: [Transaction.t()] } @@ -91,7 +82,6 @@ defmodule Explorer.Chain.Statistics do lag: %Duration{seconds: 0, megaseconds: 0, microseconds: 0}, number: -1, timestamp: nil, - transaction_count: 0, transaction_velocity: 0, transactions: [] @@ -119,7 +109,6 @@ defmodule Explorer.Chain.Statistics do block_velocity: query_value(@block_velocity_query), blocks: Repo.all(blocks), lag: query_duration(@lag_query), - transaction_count: query_value(@transaction_count_query), transaction_velocity: query_value(@transaction_velocity_query), transactions: transactions } diff --git a/apps/explorer/test/explorer/chain/statistics_test.exs b/apps/explorer/test/explorer/chain/statistics_test.exs index 342698e009..1837717604 100644 --- a/apps/explorer/test/explorer/chain/statistics_test.exs +++ b/apps/explorer/test/explorer/chain/statistics_test.exs @@ -42,24 +42,6 @@ defmodule Explorer.Chain.StatisticsTest do } = Statistics.fetch() end - test "returns the count of transactions from blocks in the last day" do - time = DateTime.utc_now() - block = insert(:block, timestamp: time) - - :transaction - |> insert() - |> with_block(block) - - last_week = Timex.shift(time, days: -8) - old_block = insert(:block, timestamp: last_week) - - :transaction - |> insert() - |> with_block(old_block) - - assert %Statistics{transaction_count: 1} = Statistics.fetch() - end - test "returns the lag between validation and insertion time" do validation_time = DateTime.utc_now() inserted_at = validation_time |> Timex.shift(seconds: 5)