Record anyway

This commit is contained in:
zakhy 2024-10-23 11:59:21 +07:00
parent d9f813d262
commit eab4596db7

View File

@ -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():