From d3069bbcf5bd3b6bfeb5f2a14dcd2477ea3f1d22 Mon Sep 17 00:00:00 2001 From: elroy Date: Wed, 12 Jul 2017 08:26:47 +0200 Subject: [PATCH] Fix bug in tradeHistoryFilter --- .../nl/komtek/gpi/controllers/GunbotProxyController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/nl/komtek/gpi/controllers/GunbotProxyController.java b/src/main/java/nl/komtek/gpi/controllers/GunbotProxyController.java index e1674de..3ed2abc 100644 --- a/src/main/java/nl/komtek/gpi/controllers/GunbotProxyController.java +++ b/src/main/java/nl/komtek/gpi/controllers/GunbotProxyController.java @@ -52,7 +52,7 @@ public class GunbotProxyController { String result = gunbotProxyService.getChartData(currencyPair, period); - return filterChartDataByDate(start,result); + return filterChartDataByDate(start, result); } @RequestMapping(value = "/public/**", params = "command=returnTicker") @@ -164,13 +164,13 @@ public class GunbotProxyController { JsonElement jElement = jsonParser.parse(result); JsonObject jObject = jElement.getAsJsonObject(); JsonObject filteredjObject = new JsonObject(); - JsonArray filteredjArray = new JsonArray(); for (Map.Entry entry : jObject.entrySet()) { if (!currency.equalsIgnoreCase("all") && !currency.equalsIgnoreCase(entry.getKey().toString())) { continue; } - List tradeHistory = mapper.mapTradeHistory(entry.getValue().toString()); + List tradeHistory = mapper.mapTradeHistory(entry.getValue().toString()); + JsonArray filteredjArray = new JsonArray(); tradeHistory.stream() .filter(e -> e.date.toEpochSecond(ZoneOffset.UTC) >= startLong) .map(e -> jsonParser.parse(e.toString())) @@ -182,7 +182,7 @@ public class GunbotProxyController { if (currency.equals("all")) { return (filteredjObject.entrySet().size() == 0) ? "[]" : filteredjObject.toString(); } else { - return (filteredjArray.size() == 0) ? "[]" : filteredjArray.toString(); + return (filteredjObject.entrySet().size() == 0) ? "[]" : filteredjObject.getAsJsonArray(currency).toString(); } }