From eab4596db7f34a94e373a0447416b79c3defe13e Mon Sep 17 00:00:00 2001 From: zakhy Date: Wed, 23 Oct 2024 11:59:21 +0700 Subject: [PATCH] Record anyway --- .../commands/start_pooling_ws.py | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/apps/workerslocation/commands/start_pooling_ws.py b/apps/workerslocation/commands/start_pooling_ws.py index d85829b..a493b2e 100644 --- a/apps/workerslocation/commands/start_pooling_ws.py +++ b/apps/workerslocation/commands/start_pooling_ws.py @@ -76,22 +76,14 @@ def create_or_update_location(data): try: location = WorkersLocation.objects.get(abonent_id=abonent_id) # Проверяем, нужно ли обновлять поля - if (location.latitude != latitude or - location.longitude != longitude or - location.velocity != velocity or - location.radius != radius): - # Обновляем только изменившиеся поля - location.latitude = latitude - location.longitude = longitude - location.velocity = velocity - location.radius = radius - location.update_time = update_time - location.save() - return True - else: - location.update_time = update_time - location.save() + # Обновляем только изменившиеся поля + location.latitude = latitude + location.longitude = longitude + location.velocity = velocity + location.radius = radius + location.update_time = update_time + location.save() except WorkersLocation.DoesNotExist: WorkersLocation.objects.create( abonent_id=abonent_id, @@ -101,7 +93,6 @@ def create_or_update_location(data): radius=radius, update_time=update_time ) - return True async def main():