Fix operation tree bug

This commit is contained in:
wqy
2022-09-03 08:21:43 +08:00
parent 122f3ebddc
commit b5a8051c61

View File

@@ -12,10 +12,10 @@ def _update_current_operation(name: str, old_id: int, id: int) -> None:
def _add_redo_undo(name: str, redo: str, undo: str) -> int:
with conn[name].cursor(row_factory=dict_row) as cur:
cur.execute("select max(id) from operation")
parent = int(cur.fetchone()['max'])
parent = _get_current_operation(name)
cur.execute(f"insert into operation (id, redo, undo, parent) values (default, '{redo}', '{undo}', {parent})")
return parent + 1
cur.execute("select max(id) from operation")
return int(cur.fetchone()['max'])
# execute curr undo
def _query_undo(name: str, id: str) -> dict[str, str]: