From f77e3a3a74f6c37bfe4603a2c3dc77076b116880 Mon Sep 17 00:00:00 2001 From: Sabron Date: Tue, 11 Mar 2025 10:31:23 +0700 Subject: [PATCH] update : 11.03.2025 10:31:23,84 --- start.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/start.py b/start.py index 4e50dec..fd5bc06 100644 --- a/start.py +++ b/start.py @@ -213,14 +213,23 @@ def test_edds(): #for row in cursor_row: # print(row) - SQL_QUERY = r"SELECT * FROM objectstatus" - cursor = mssql.executeSQL(conn, SQL_QUERY) - cursor_row = cursor.fetchall() - for row in cursor_row: - print(row) element.save() #print(my_b.decode()) + SQL_QUERY = r"SELECT * FROM objectstatus" + cursor = mssql.executeSQL(conn, SQL_QUERY) + cursor_row = cursor.fetchall() + for data in cursor_row: + print(data) + element = Equipment.objects.filter(uid=data[0]).first() + lon = 0 if data[4] is None else data[4] + lat = 0 if data[3] is None else data[3] + if element is not None: + element.lat = lat + element.lon = lon + element.save() + + cursor.close() conn.close() return None