From a4f4679f1e5d9b4a7e20832f10f9522064fb7d4b Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Mon, 24 Apr 2023 13:57:37 +0400 Subject: [PATCH] #91 -- fix time series tendency estimation --- .../java/ru/ulstu/extractor/ts/service/TimeSeriesService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java index 6dba38c..f28a031 100644 --- a/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java +++ b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java @@ -128,7 +128,8 @@ public class TimeSeriesService { if (ts != null && ts.getValues().size() > MIN_TIME_SERIES_LENGTH) { JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new JsonTimeSeries(normalizeTimeSeries(ts)))); LOG.debug("Успешно отправлен на сервис сглаживания"); - if (response.has("response") && response.getString("response").equals("empty")) { + if (response.has("response") && response.getString("response").equals("empty") + || !response.has("timeSeries")) { return DEFAULT_TIME_SERIES_TENDENCY; } JSONArray jsonArray = response.getJSONObject("timeSeries").getJSONArray("values");