Need insert since it requires update later

This commit is contained in:
WQY\qiong
2023-03-24 21:17:22 +08:00
parent f44876427d
commit 7451cf9ddd
4 changed files with 2 additions and 7 deletions

View File

@@ -9,7 +9,8 @@ def _to_client_point(coord: str) -> dict[str, float]:
def get_node_coord(name: str, id: str) -> dict[str, float]:
row = try_read(name, f"select * from coordinates where node = '{id}'")
if row == None:
return {}
write(name, f"insert into coordinates (node, coord) values ('{id}', '(0.0,0.0)');")
return {'x': 0.0, 'y': 0.0}
return _to_client_point(row['coord'])