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