#9 -- fix dates

This commit is contained in:
Anton Romanov 2021-08-20 11:44:30 +04:00
parent 17d21c1312
commit aa4f4a91c4

View File

@ -26,7 +26,6 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -74,9 +73,10 @@ public class IndexController {
ModelingResult modelingResult = timeSeriesService.getForecast(timeSeries, countForecastPoints); ModelingResult modelingResult = timeSeriesService.getForecast(timeSeries, countForecastPoints);
TimeSeries forecast = modelingResult.getTimeSeries(); TimeSeries forecast = modelingResult.getTimeSeries();
TimeSeries testForecast = modelingResult.getTestForecast(); TimeSeries testForecast = modelingResult.getTestForecast();
Set<String> dates = timeSeries.getValues().stream() List<String> dates = timeSeries.getValues().stream()
.map(v -> v.getDate().format(DateTimeFormatter.ISO_DATE)) .map(v -> v.getDate().format(DateTimeFormatter.ISO_DATE))
.collect(Collectors.toSet()); .distinct()
.collect(Collectors.toList());
dates.addAll(forecast.getValues().stream() dates.addAll(forecast.getValues().stream()
.map(v -> v.getDate().format(DateTimeFormatter.ISO_DATE)) .map(v -> v.getDate().format(DateTimeFormatter.ISO_DATE))
.collect(Collectors.toSet())); .collect(Collectors.toSet()));