From bb9e32e8bdab4d8b04f1883f6d1f54dd547b6659 Mon Sep 17 00:00:00 2001 From: slightlycyborg Date: Thu, 25 Jul 2019 19:50:26 +0000 Subject: [PATCH] Fixed function nil.number_of_transactions/0 is undefined in tests --- .../lib/block_scout_web/controllers/chain_controller.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex index 5571334214..12b440f713 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex @@ -28,6 +28,14 @@ defmodule BlockScoutWeb.ChainController do transaction_stats = get_transaction_stats() + # Hack for render during testing + transaction_stats = + if length(transaction_stats) == 0 do + [%{number_of_transactions: 0}] + else + transaction_stats + end + chart_data_paths = %{ market: market_history_chart_path(conn, :show), transaction: transaction_history_chart_path(conn, :show)