#91 -- fix time series tendency estimation

This commit is contained in:
Anton Romanov 2023-04-24 13:57:37 +04:00
parent 09abd351fb
commit a4f4679f1e

View File

@ -128,7 +128,8 @@ public class TimeSeriesService {
if (ts != null && ts.getValues().size() > MIN_TIME_SERIES_LENGTH) { if (ts != null && ts.getValues().size() > MIN_TIME_SERIES_LENGTH) {
JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new JsonTimeSeries(normalizeTimeSeries(ts)))); JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new JsonTimeSeries(normalizeTimeSeries(ts))));
LOG.debug("Успешно отправлен на сервис сглаживания"); 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; return DEFAULT_TIME_SERIES_TENDENCY;
} }
JSONArray jsonArray = response.getJSONObject("timeSeries").getJSONArray("values"); JSONArray jsonArray = response.getJSONObject("timeSeries").getJSONArray("values");