Deductable rest calculation

* enables new deductable_rest calculation for eco account migration
This commit is contained in:
mpeltriaux 2022-10-14 06:56:13 +02:00
parent 0bd6892583
commit eb2aa5cf2c

View File

@ -130,7 +130,6 @@ class EcoAccountMigrater(CompensationMigrater):
area = round(rlp_geom.area)
max_state_after_area = instance.get_state_after_surface_sum()
# Check whether the geometric area is at least
diff = abs(area - max_state_after_area)
diff_perc = diff / max(area, max_state_after_area)
is_diff_too_high = diff_perc > 0.1
@ -145,6 +144,7 @@ class EcoAccountMigrater(CompensationMigrater):
instance.deductable_surface = area
instance.geometry.geom = db_result_geom if not db_result_geom.empty else None
instance.geometry.save()
instance.update_deductable_rest()
celery_update_parcels.delay(instance.geometry.id)
except TypeError:
raise TypeError(f"{identifier}, {db_result_geom}")