From 02bfc7e8dc68f4594a8ae9ded5efb9beb911ec40 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 8 Aug 2019 12:47:09 +0300 Subject: [PATCH 1/2] fix coin history chart data --- .../controllers/address_coin_balance_by_day_controller.ex | 7 ++++++- .../address_coin_balance_by_day_controller_test.exs | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex index 6af67c4861..b440fc7d9f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex @@ -9,7 +9,12 @@ defmodule BlockScoutWeb.AddressCoinBalanceByDayController do def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"}) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string) do - balances_by_day = Chain.address_to_balances_by_day(address_hash) + balances_by_day = + address_hash + |> Chain.address_to_balances_by_day() + |> Enum.map(fn %{value: value} = map -> + Map.put(map, :value, Decimal.to_float(value)) + end) json(conn, balances_by_day) end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs index e835ba71ce..1496bb24e9 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs @@ -14,7 +14,10 @@ defmodule BlockScoutWeb.AddressCoinBalanceByDayControllerTest do response = json_response(conn, 200) - assert length(response) == 2 + assert [ + %{"date" => _, "value" => 2.0e-15}, + %{"date" => _, "value" => 1.0e-15} + ] = response end end end From b534b9b1078291ed1379d4c38b7febb0415a7f26 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 8 Aug 2019 12:51:00 +0300 Subject: [PATCH 2/2] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 213c27d218..55161393af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#2456](https://github.com/poanetwork/blockscout/pull/2456) - fetch pending transactions for geth ### Fixes +- [#2528](https://github.com/poanetwork/blockscout/pull/2528) - fix coin history chart data - [#2503](https://github.com/poanetwork/blockscout/pull/2503) - Mitigate autocompletion library influence to page loading performance - [#2502](https://github.com/poanetwork/blockscout/pull/2502) - increase reward task timeout - [#2463](https://github.com/poanetwork/blockscout/pull/2463) - dark theme fixes