Fix operation tree bug
This commit is contained in:
@@ -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:
|
def _add_redo_undo(name: str, redo: str, undo: str) -> int:
|
||||||
with conn[name].cursor(row_factory=dict_row) as cur:
|
with conn[name].cursor(row_factory=dict_row) as cur:
|
||||||
cur.execute("select max(id) from operation")
|
parent = _get_current_operation(name)
|
||||||
parent = int(cur.fetchone()['max'])
|
|
||||||
cur.execute(f"insert into operation (id, redo, undo, parent) values (default, '{redo}', '{undo}', {parent})")
|
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
|
# execute curr undo
|
||||||
def _query_undo(name: str, id: str) -> dict[str, str]:
|
def _query_undo(name: str, id: str) -> dict[str, str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user