This commit is contained in:
DingZQ
2022-09-15 14:16:55 +08:00

View File

@@ -40,7 +40,7 @@ def delete_junction(name: str, id: str) -> ChangeSet:
pattern = 'NULL' if row['pattern'] == None else row['pattern']
pattern = f'"{pattern}"' if pattern != 'NULL' else pattern
cur.execute(f"select * from coordinates where id = '{id}'")
cur.execute(f"select * from coordinates where node = '{id}'")
row = cur.fetchone()
if row == None:
return
@@ -53,9 +53,9 @@ def delete_junction(name: str, id: str) -> ChangeSet:
cur.execute(sql)
redo = sql.replace("'", '"')
undo = f'insert into _node (id, type) values ("{id}", "{type}");'
undo += f" insert into junctions (id, elevation, demand, pattern) values ('{id}', {elevation}, {demand}, {pattern});"
undo += f" insert into coordinates (node, coord) values ('{id}', '{coord}');"
undo = f'insert into _node (id, type) values ("{id}", "JUNCTION");'
undo += f' insert into junctions (id, elevation, demand, pattern) values ("{id}", {elevation}, {demand}, {pattern});'
undo += f' insert into coordinates (node, coord) values ("{id}", "{coord}");'
add_operation(name, redo, undo)
change = ChangeSet()