From e4fbb8bfa19dd245e519d234af4600175bbfefd5 Mon Sep 17 00:00:00 2001 From: Joost Date: Sat, 4 Apr 2020 19:52:07 +0200 Subject: [PATCH] Fixed import progress meters --- .../java/de/sakpaas/backend/service/LocationService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/sakpaas/backend/service/LocationService.java b/src/main/java/de/sakpaas/backend/service/LocationService.java index de1643cb..b7a90c4e 100644 --- a/src/main/java/de/sakpaas/backend/service/LocationService.java +++ b/src/main/java/de/sakpaas/backend/service/LocationService.java @@ -105,6 +105,10 @@ public Location save(Location location) { * Making an Request to the OverpassAPI, insert or update the Locations in the Database, deleting the unused locations */ public void updateDatabase() { + // Reset import progress + importLocationProgress.set(0.0); + deleteLocationProgress.set(0.0); + // Download data from OSM LOGGER.warn("Starting OSM import... (1/4)"); List results = locationApiSearchDAS.getLocationsForCountry("DE"); @@ -124,7 +128,6 @@ public void updateDatabase() { // Insert or update data one by one in the table LOGGER.warn("Importing OSM data to database... (3/4)"); - importLocationProgress.set(0.0); for (int i = 0; i < results.size(); i++) { OSMResultLocationListDto.OMSResultLocationDto osmLocation = results.get(i); if (locationIds.contains(osmLocation.getId())) { @@ -159,6 +162,7 @@ public void updateDatabase() { LOGGER.info("Location deletion: " + progress * 100.0 + " %"); } } + deleteLocationProgress.set(1.0); LOGGER.info("Finished deleting " + locationIds.size() + " not existing Locations! (3/4)"); LOGGER.info("Finished data import from OSM! (4/4)");