From 91a26906c0fba62f242502db559024d52cd1f48c Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 15 Apr 2019 16:15:42 +0300 Subject: [PATCH] fix credo --- apps/explorer/lib/explorer/chain.ex | 4 ++-- apps/explorer/test/explorer/chain_test.exs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index 18e7b58c3b..c569a3584f 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -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 diff --git a/apps/explorer/test/explorer/chain_test.exs b/apps/explorer/test/explorer/chain_test.exs index 661b15c3eb..f0cf0b9210 100644 --- a/apps/explorer/test/explorer/chain_test.exs +++ b/apps/explorer/test/explorer/chain_test.exs @@ -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")} ] end end