diff --git a/avni-server-api/src/main/java/org/avni/server/service/LocationService.java b/avni-server-api/src/main/java/org/avni/server/service/LocationService.java index a9501e585..57ced73d2 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/LocationService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/LocationService.java @@ -177,12 +177,13 @@ public AddressLevel update(LocationEditContract locationEditContract, Long id) { } public void updateParent(AddressLevel location, AddressLevel newParent) { + Long oldParentId = location.getParentId(); location.setLineage(updateLineage(location, newParent.getLineage())); location.setParent(newParent); locationRepository.save(location); updateDescendantLocationLineage(locationRepository.findAllByParent(location), location.getLineage()); updateLocationMapping(location, newParent); - resetSyncService.recordLocationParentChange(location, location.getParentId()); + resetSyncService.recordLocationParentChange(location, oldParentId); } private void updateParent(AddressLevel location, Long newParentId) {