From a68ec64a4b12c09d1d714eb856d13b931aee0120 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 25 May 2020 13:49:45 +0300 Subject: [PATCH] Fix tests --- .../templates/transaction/overview.html.eex | 2 + .../block_scout_web/views/transaction_view.ex | 14 ++-- apps/block_scout_web/priv/gettext/default.pot | 68 +++++++++---------- .../priv/gettext/en/LC_MESSAGES/default.po | 68 +++++++++---------- 4 files changed, 80 insertions(+), 72 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index 63c7c0ca25..cca53f0865 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -94,6 +94,8 @@ <%= case processing_time_duration(@transaction) do %> <% :pending -> %> <% nil %> + <% :unknown -> %> + <% nil %> <% {:ok, interval_string} -> %>
<%= gettext "Transaction Speed" %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index c495791de5..1c01ab80a3 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -145,11 +145,17 @@ defmodule BlockScoutWeb.TransactionView do end def processing_time_duration(%Transaction{earliest_processing_start: nil}) do - avg_time = - AverageBlockTime.average_block_time() - |> Duration.to_seconds() + avg_time = AverageBlockTime.average_block_time() - {:ok, "<= #{avg_time} seconds"} + if avg_time == {:error, :disabled} do + :unknown + else + avg_time_in_secs = + avg_time + |> Duration.to_seconds() + + {:ok, "<= #{avg_time_in_secs} seconds"} + end end def processing_time_duration(%Transaction{ diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 054a7f3a73..6aa0491090 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -13,7 +13,7 @@ msgstr[0] "" msgstr[1] "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:194 +#: lib/block_scout_web/templates/transaction/overview.html.eex:196 msgid " Token Transfer" msgstr "" @@ -59,7 +59,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:241 +#: lib/block_scout_web/views/transaction_view.ex:247 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -355,12 +355,12 @@ msgid "Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:330 +#: lib/block_scout_web/views/transaction_view.ex:336 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:327 +#: lib/block_scout_web/views/transaction_view.ex:333 msgid "Contract Creation" msgstr "" @@ -621,12 +621,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:245 +#: lib/block_scout_web/views/transaction_view.ex:251 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:243 +#: lib/block_scout_web/views/transaction_view.ex:249 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -646,8 +646,8 @@ msgstr "" #: lib/block_scout_web/templates/layout/app.html.eex:32 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29 -#: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:181 +#: lib/block_scout_web/templates/transaction/overview.html.eex:255 #: lib/block_scout_web/views/wei_helpers.ex:78 msgid "Ether" msgstr "" @@ -753,8 +753,8 @@ msgid "Hash" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:113 -#: lib/block_scout_web/templates/transaction/overview.html.eex:117 +#: lib/block_scout_web/templates/transaction/overview.html.eex:115 +#: lib/block_scout_web/templates/transaction/overview.html.eex:119 msgid "Hex (Default)" msgstr "" @@ -776,7 +776,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:242 +#: lib/block_scout_web/views/transaction_view.ex:248 msgid "Success" msgstr "" @@ -891,7 +891,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:12 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:10 -#: lib/block_scout_web/views/transaction_view.ex:323 +#: lib/block_scout_web/views/transaction_view.ex:329 msgid "Token Transfer" msgstr "" @@ -906,7 +906,7 @@ msgstr "" #: lib/block_scout_web/views/address_view.ex:325 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:90 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:384 +#: lib/block_scout_web/views/transaction_view.ex:390 msgid "Token Transfers" msgstr "" @@ -922,7 +922,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 -#: lib/block_scout_web/views/transaction_view.ex:333 +#: lib/block_scout_web/views/transaction_view.ex:339 msgid "Transaction" msgstr "" @@ -1005,7 +1005,7 @@ msgid "License ID" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:283 msgid "Limit" msgstr "" @@ -1046,7 +1046,7 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:226 +#: lib/block_scout_web/views/transaction_view.ex:232 msgid "Max of" msgstr "" @@ -1159,8 +1159,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:59 -#: lib/block_scout_web/views/transaction_view.ex:240 -#: lib/block_scout_web/views/transaction_view.ex:274 +#: lib/block_scout_web/views/transaction_view.ex:246 +#: lib/block_scout_web/views/transaction_view.ex:280 msgid "Pending" msgstr "" @@ -1201,14 +1201,14 @@ msgid "RPC" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:107 +#: lib/block_scout_web/templates/transaction/overview.html.eex:109 msgid "Raw Input" msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:387 +#: lib/block_scout_web/views/transaction_view.ex:393 msgid "Raw Trace" msgstr "" @@ -1488,7 +1488,7 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:99 +#: lib/block_scout_web/templates/transaction/overview.html.eex:101 msgid "Transaction Speed" msgstr "" @@ -1518,7 +1518,7 @@ msgid "Type" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:120 +#: lib/block_scout_web/templates/transaction/overview.html.eex:122 msgid "UTF-8" msgstr "" @@ -1544,7 +1544,7 @@ msgid "Use the search box to find a hosted network, or select from the list of a msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:275 +#: lib/block_scout_web/templates/transaction/overview.html.eex:277 msgid "Used" msgstr "" @@ -1574,8 +1574,8 @@ msgid "Validator Info" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:181 +#: lib/block_scout_web/templates/transaction/overview.html.eex:255 msgid "Value" msgstr "" @@ -1752,7 +1752,7 @@ msgid "Decimals" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:271 +#: lib/block_scout_web/templates/transaction/overview.html.eex:273 msgid "Gas" msgstr "" @@ -1799,8 +1799,8 @@ msgid "Transfers" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:132 -#: lib/block_scout_web/templates/transaction/overview.html.eex:145 +#: lib/block_scout_web/templates/transaction/overview.html.eex:134 +#: lib/block_scout_web/templates/transaction/overview.html.eex:147 msgid "Copy Txn Input" msgstr "" @@ -1838,7 +1838,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:324 -#: lib/block_scout_web/views/transaction_view.ex:385 +#: lib/block_scout_web/views/transaction_view.ex:391 msgid "Internal Transactions" msgstr "" @@ -1848,7 +1848,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:331 -#: lib/block_scout_web/views/transaction_view.ex:386 +#: lib/block_scout_web/views/transaction_view.ex:392 msgid "Logs" msgstr "" @@ -1881,26 +1881,26 @@ msgid "Transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:230 +#: lib/block_scout_web/templates/transaction/overview.html.eex:232 msgid " Token Burning" msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:8 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:6 -#: lib/block_scout_web/views/transaction_view.ex:322 +#: lib/block_scout_web/views/transaction_view.ex:328 msgid "Token Burning" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:212 +#: lib/block_scout_web/templates/transaction/overview.html.eex:214 msgid " Token Minting" msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:321 +#: lib/block_scout_web/views/transaction_view.ex:327 msgid "Token Minting" msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 054a7f3a73..6aa0491090 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -13,7 +13,7 @@ msgstr[0] "" msgstr[1] "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:194 +#: lib/block_scout_web/templates/transaction/overview.html.eex:196 msgid " Token Transfer" msgstr "" @@ -59,7 +59,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:241 +#: lib/block_scout_web/views/transaction_view.ex:247 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -355,12 +355,12 @@ msgid "Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:330 +#: lib/block_scout_web/views/transaction_view.ex:336 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:327 +#: lib/block_scout_web/views/transaction_view.ex:333 msgid "Contract Creation" msgstr "" @@ -621,12 +621,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:245 +#: lib/block_scout_web/views/transaction_view.ex:251 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:243 +#: lib/block_scout_web/views/transaction_view.ex:249 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -646,8 +646,8 @@ msgstr "" #: lib/block_scout_web/templates/layout/app.html.eex:32 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29 -#: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:181 +#: lib/block_scout_web/templates/transaction/overview.html.eex:255 #: lib/block_scout_web/views/wei_helpers.ex:78 msgid "Ether" msgstr "" @@ -753,8 +753,8 @@ msgid "Hash" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:113 -#: lib/block_scout_web/templates/transaction/overview.html.eex:117 +#: lib/block_scout_web/templates/transaction/overview.html.eex:115 +#: lib/block_scout_web/templates/transaction/overview.html.eex:119 msgid "Hex (Default)" msgstr "" @@ -776,7 +776,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:242 +#: lib/block_scout_web/views/transaction_view.ex:248 msgid "Success" msgstr "" @@ -891,7 +891,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:12 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:10 -#: lib/block_scout_web/views/transaction_view.ex:323 +#: lib/block_scout_web/views/transaction_view.ex:329 msgid "Token Transfer" msgstr "" @@ -906,7 +906,7 @@ msgstr "" #: lib/block_scout_web/views/address_view.ex:325 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:90 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:384 +#: lib/block_scout_web/views/transaction_view.ex:390 msgid "Token Transfers" msgstr "" @@ -922,7 +922,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 -#: lib/block_scout_web/views/transaction_view.ex:333 +#: lib/block_scout_web/views/transaction_view.ex:339 msgid "Transaction" msgstr "" @@ -1005,7 +1005,7 @@ msgid "License ID" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:283 msgid "Limit" msgstr "" @@ -1046,7 +1046,7 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:226 +#: lib/block_scout_web/views/transaction_view.ex:232 msgid "Max of" msgstr "" @@ -1159,8 +1159,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:59 -#: lib/block_scout_web/views/transaction_view.ex:240 -#: lib/block_scout_web/views/transaction_view.ex:274 +#: lib/block_scout_web/views/transaction_view.ex:246 +#: lib/block_scout_web/views/transaction_view.ex:280 msgid "Pending" msgstr "" @@ -1201,14 +1201,14 @@ msgid "RPC" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:107 +#: lib/block_scout_web/templates/transaction/overview.html.eex:109 msgid "Raw Input" msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:387 +#: lib/block_scout_web/views/transaction_view.ex:393 msgid "Raw Trace" msgstr "" @@ -1488,7 +1488,7 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:99 +#: lib/block_scout_web/templates/transaction/overview.html.eex:101 msgid "Transaction Speed" msgstr "" @@ -1518,7 +1518,7 @@ msgid "Type" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:120 +#: lib/block_scout_web/templates/transaction/overview.html.eex:122 msgid "UTF-8" msgstr "" @@ -1544,7 +1544,7 @@ msgid "Use the search box to find a hosted network, or select from the list of a msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:275 +#: lib/block_scout_web/templates/transaction/overview.html.eex:277 msgid "Used" msgstr "" @@ -1574,8 +1574,8 @@ msgid "Validator Info" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:181 +#: lib/block_scout_web/templates/transaction/overview.html.eex:255 msgid "Value" msgstr "" @@ -1752,7 +1752,7 @@ msgid "Decimals" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:271 +#: lib/block_scout_web/templates/transaction/overview.html.eex:273 msgid "Gas" msgstr "" @@ -1799,8 +1799,8 @@ msgid "Transfers" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:132 -#: lib/block_scout_web/templates/transaction/overview.html.eex:145 +#: lib/block_scout_web/templates/transaction/overview.html.eex:134 +#: lib/block_scout_web/templates/transaction/overview.html.eex:147 msgid "Copy Txn Input" msgstr "" @@ -1838,7 +1838,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:324 -#: lib/block_scout_web/views/transaction_view.ex:385 +#: lib/block_scout_web/views/transaction_view.ex:391 msgid "Internal Transactions" msgstr "" @@ -1848,7 +1848,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:331 -#: lib/block_scout_web/views/transaction_view.ex:386 +#: lib/block_scout_web/views/transaction_view.ex:392 msgid "Logs" msgstr "" @@ -1881,26 +1881,26 @@ msgid "Transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:230 +#: lib/block_scout_web/templates/transaction/overview.html.eex:232 msgid " Token Burning" msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:8 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:6 -#: lib/block_scout_web/views/transaction_view.ex:322 +#: lib/block_scout_web/views/transaction_view.ex:328 msgid "Token Burning" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:212 +#: lib/block_scout_web/templates/transaction/overview.html.eex:214 msgid " Token Minting" msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:321 +#: lib/block_scout_web/views/transaction_view.ex:327 msgid "Token Minting" msgstr ""