Support to unset
This commit is contained in:
@@ -28,7 +28,8 @@ def set_curve(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
# TODO: transaction ?
|
||||
redo_sql = f"delete from curves where id = {f_id};"
|
||||
redo_sql += f"\ndelete from _curve where id = {f_id};"
|
||||
redo_sql += f"\ninsert into _curve (id) values ({f_id});"
|
||||
if len(cs.operations[0]['coords']) > 0:
|
||||
redo_sql += f"\ninsert into _curve (id) values ({f_id});"
|
||||
for xy in cs.operations[0]['coords']:
|
||||
x, y = float(xy['x']), float(xy['y'])
|
||||
f_x, f_y = x, y
|
||||
@@ -37,7 +38,8 @@ def set_curve(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
|
||||
undo_sql = f"delete from curves where id = {f_id};"
|
||||
undo_sql += f"\ndelete from _curve where id = {f_id};"
|
||||
undo_sql += f"\ninsert into _curve (id) values ({f_id});"
|
||||
if len(old['coords']) > 0:
|
||||
undo_sql += f"\ninsert into _curve (id) values ({f_id});"
|
||||
for xy in old['coords']:
|
||||
f_x, f_y = xy['x'], xy['y']
|
||||
undo_sql += f"\ninsert into curves (id, x, y) values ({f_id}, {f_x}, {f_y});"
|
||||
|
||||
Reference in New Issue
Block a user