Return empty change set

This commit is contained in:
wqy
2022-09-17 18:31:00 +08:00
parent a72115e15f
commit b52515b26f
8 changed files with 47 additions and 50 deletions

View File

@@ -25,11 +25,12 @@ def get_node_coord(name: str, id: str) -> dict[str, float] | None:
def set_node_coord(name: str, id: str, x: float, y: float) -> ChangeSet:
if not is_junction(name, id):
return
return ChangeSet()
old = get_node_coord(name, id)
if old == None:
return
return ChangeSet()
old_x, old_y = old['x'], old['y']
with conn[name].cursor() as cur:
@@ -42,4 +43,4 @@ def set_node_coord(name: str, id: str, x: float, y: float) -> ChangeSet:
change = ChangeSet()
change.update('junction', id, 'coord', 'point', str({'x': x, 'y': y}))
return change
return change