Merge pull request #2528 from poanetwork/ab-fix-coin-history-chart

fix coin history chart data
pull/2532/head
Victor Baranov 5 years ago committed by GitHub
commit bee7d5c407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex
  3. 5
      apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs

@ -8,6 +8,7 @@
- [#2403](https://github.com/poanetwork/blockscout/pull/2403) - Return gasPrice field at the result of gettxinfo method - [#2403](https://github.com/poanetwork/blockscout/pull/2403) - Return gasPrice field at the result of gettxinfo method
### Fixes ### Fixes
- [#2528](https://github.com/poanetwork/blockscout/pull/2528) - fix coin history chart data
- [#2520](https://github.com/poanetwork/blockscout/pull/2520) - Hide loading message when fetching is failed - [#2520](https://github.com/poanetwork/blockscout/pull/2520) - Hide loading message when fetching is failed
- [#2523](https://github.com/poanetwork/blockscout/pull/2523) - Avoid importing internal_transactions of pending transactions - [#2523](https://github.com/poanetwork/blockscout/pull/2523) - Avoid importing internal_transactions of pending transactions
- [#2519](https://github.com/poanetwork/blockscout/pull/2519) - enable `First` page button in pagination - [#2519](https://github.com/poanetwork/blockscout/pull/2519) - enable `First` page button in pagination

@ -9,7 +9,12 @@ defmodule BlockScoutWeb.AddressCoinBalanceByDayController do
def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"}) 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 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) json(conn, balances_by_day)
end end

@ -14,7 +14,10 @@ defmodule BlockScoutWeb.AddressCoinBalanceByDayControllerTest do
response = json_response(conn, 200) response = json_response(conn, 200)
assert length(response) == 2 assert [
%{"date" => _, "value" => 2.0e-15},
%{"date" => _, "value" => 1.0e-15}
] = response
end end
end end
end end

Loading…
Cancel
Save