@ -2622,8 +2622,8 @@ defmodule Explorer.Chain do
today = Date.to_string(NaiveDateTime.utc_now())
if Enum.count(result) > 0 && !Enum.any?(result, fn map -> map[:data] == today end) do
result ++ [%{date: today, value: List.last(result)[:value]}]
if Enum.count(result) > 0 && !Enum.any?(result, fn map -> map[:date] == today end) do
[%{date: today, value: List.last(result)[:value]} | result]
else
result
end
@ -3677,8 +3677,8 @@ defmodule Explorer.ChainTest do
balances = Chain.address_to_balances_by_day(address.hash)
assert balances == [
%{date: "2019-04-14", value: Decimal.new("1E-15")},
%{date: "2019-04-15", value: Decimal.new("1E-15")}
%{date: "2019-04-15", value: Decimal.new("1E-15")},
%{date: "2019-04-14", value: Decimal.new("1E-15")}
]