Commit d1255f13 authored by oleg.pahhomov's avatar oleg.pahhomov

Missing map data for families who have received subsistence benefits

parent a65829ed
......@@ -31,7 +31,6 @@ import ee.stat.dashboard.service.statdata.StatDimensionsService;
import ee.stat.dashboard.service.statdata.StatUrlBuilderService;
import ee.stat.dashboard.service.statdata.dto.UrlConfig;
import ee.stat.dashboard.service.statdata.xml.XmlDimension;
import ee.stat.dashboard.service.statdata.xml.XmlValue;
import ee.stat.dashboard.service.statsync.StatDbUpdater;
import ee.stat.dashboard.service.statsync.dto.StatDbResponse;
import ee.stat.dashboard.service.widget.importer.dto.ImportResult;
......@@ -43,7 +42,6 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import static ee.stat.dashboard.service.widget.importer.conditions.ImportConditions.*;
......@@ -143,9 +141,9 @@ public class WidgetSaveImporter {
}
Filter newFilter = new Filter();
BeanUtils.copyProperties(filter, newFilter);
setFilterCommon(savedWidget, savedGraph, newFilter);
List<FilterValue> values = getTimeFilterValues(savedWidget, savedGraph, filter, newFilter);
setFilterCommon(savedWidget, savedGraph, newFilter, values);
values.forEach(v -> v.setOrderNr(values.indexOf(v)));
updateSelected(newFilter, values);
saveValues(filterRepository.save(newFilter), values);
......@@ -181,9 +179,9 @@ public class WidgetSaveImporter {
Filter newFilter = copyFilter(filter);
newFilter.setType(FilterDisplay.MENU);
setAxis(savedWidget, savedGraph, newFilter);
setFilterCommon(savedWidget, savedGraph, newFilter);
List<FilterValue> values = getFilterValues(savedWidget, savedGraph, newFilter);
setFilterCommon(savedWidget, savedGraph, newFilter, values);
values.forEach(v -> v.setOrderNr(values.indexOf(v)));
updateSelected(newFilter, values);
saveValues(filterRepository.save(newFilter), values);
......@@ -253,10 +251,10 @@ public class WidgetSaveImporter {
return withoutTotal(filter);
} else if (savedGraph.getType().isVerticalOrTreemap() && areaForBusinessBuildingType(savedWidget, filter)) {
return withoutConstrTotal(filter);
} else if (familiesWhoRecievedSubsistence(savedWidget)) {
} else if (familiesWhoRecievedSubsistenceNumberOfPayments(savedWidget, filter)) {
return savedGraph.getType().isMap() ? onlyTotal(filter) : withoutTotal(filter);
} else {
return filter.getValues();
return new ArrayList<>(filter.getValues());
}
}
......@@ -267,7 +265,7 @@ public class WidgetSaveImporter {
return newFilter;
}
private void setFilterCommon(Widget savedWidget, GraphType savedGraph, Filter filter) {
private void setFilterCommon(Widget savedWidget, GraphType savedGraph, Filter filter, List<FilterValue> values) {
filter.setWidget(savedWidget.getId());
filter.setGraphType(savedGraph.getId());
TimePart timePart = TimePart.fromExcel(filter.getNameEt());
......@@ -284,7 +282,7 @@ public class WidgetSaveImporter {
} else {
filter.setNumberOfValues(savedGraph.getType().isMapOrPieOrTreemap() ? SINGLE_FILTER : MULTIFILTER_VALUES);
}
if (filter.getType().isMenu() && filter.getValues().size() == 1) {
if (filter.getType().isMenu() && values.size() == 1) {
filter.setType(FilterDisplay.CONSTRAINT);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment