|
|
|
|
@ -22,6 +22,7 @@ class PointService:
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def update_points_in_radius(qs: models.PlacementPoint, new_status: str):
|
|
|
|
|
triggers = False
|
|
|
|
|
for point in qs:
|
|
|
|
|
if new_status == PointStatus.Installation.name:
|
|
|
|
|
if point.status == PointStatus.Pending.name:
|
|
|
|
|
@ -29,15 +30,17 @@ class PointService:
|
|
|
|
|
geometry__distance_lt=(point.geometry, Distance(m=DEFAULT_PLACEMENT_POINT_UPDATE_RADIUS)),
|
|
|
|
|
)
|
|
|
|
|
pnts.update(prediction_first=F('prediction_current'), target_post_cnt=F('target_post_cnt') + 1)
|
|
|
|
|
raschet.delay()
|
|
|
|
|
triggers = True
|
|
|
|
|
elif new_status == PointStatus.Cancelled.name or new_status == PointStatus.Pending.name:
|
|
|
|
|
if point.status == PointStatus.Installation.name:
|
|
|
|
|
pnts = models.PlacementPoint.objects.filter(
|
|
|
|
|
geometry__distance_lt=(point.geometry, Distance(m=DEFAULT_PLACEMENT_POINT_UPDATE_RADIUS)),
|
|
|
|
|
)
|
|
|
|
|
pnts.update(target_post_cnt=F('target_post_cnt') - 1 if F('target_post_cnt') != 0 else 0)
|
|
|
|
|
raschet.delay()
|
|
|
|
|
triggers = True
|
|
|
|
|
elif new_status == PointStatus.Working.name and point.status == PointStatus.Pending.name:
|
|
|
|
|
triggers = True
|
|
|
|
|
if triggers:
|
|
|
|
|
raschet.delay()
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|