Skip to content

Commit

Permalink
Merge pull request #85 from SAKPaaS/bugfix/import-delete-progress
Browse files Browse the repository at this point in the history
Fixed import progress meters
  • Loading branch information
r-franzke authored Apr 4, 2020
2 parents 7646e1a + e4fbb8b commit f3d41bd
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<OSMResultLocationListDto.OMSResultLocationDto> results = locationApiSearchDAS.getLocationsForCountry("DE");
Expand All @@ -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())) {
Expand Down Expand Up @@ -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)");
Expand Down

0 comments on commit f3d41bd

Please sign in to comment.