Fix creating search tests

This commit is contained in:
max-klaus 2020-05-31 18:53:08 +03:00
parent 22566d8954
commit ca0633141a
2 changed files with 22 additions and 17 deletions

View file

@ -161,8 +161,12 @@ public class City extends MapObject {
public JSONObject toJSON(boolean includingBuildings) {
JSONObject json = super.toJSON();
if (type != null) {
json.put("type", type.name());
}
if (postcode != null) {
json.put("postcode", postcode);
}
JSONArray listOfStreetsArr = new JSONArray();
for (Street s : listOfStreets) {
listOfStreetsArr.put(s.toJSON(includingBuildings));

View file

@ -786,7 +786,7 @@ public class SearchUICore {
cities = new HashSet<>();
}
Set<Street> streets = new HashSet<>();
if (exportedObjects != null) {
for (MapObject obj : exportedObjects) {
if (obj instanceof Amenity) {
amenities.add((Amenity) obj);
@ -804,6 +804,7 @@ public class SearchUICore {
matchedCities.add(city);
}
}
}
for (City city : cities) {
List<Street> cityStreets = city.getStreets();
for (Street street : streets) {
@ -834,7 +835,7 @@ public class SearchUICore {
JSONArray citiesArr = new JSONArray();
for (City city : cities) {
final JSONObject cityObj = city.toJSON(exportSettings.isExportBuildings());
if (exportedCities.contains(city)) {
if (exportedCities != null && exportedCities.contains(city)) {
if (!exportSettings.isExportEmptyCities()) {
continue;
}