Improve update snapshot

This commit is contained in:
WQY\qiong
2023-02-17 21:35:08 +08:00
parent 68b42ef2a0
commit e88478fc13

View File

@@ -192,7 +192,10 @@ def take_snapshot(name: str, tag: str) -> int | None:
def update_snapshot(name: str, operation: int, tag: str) -> None:
if tag == None or tag == '':
return None
write(name, f"update snapshot_operation set tag = '{tag}' where id = {operation}")
if have_snapshot_for_operation(name, operation):
write(name, f"update snapshot_operation set tag = '{tag}' where id = {operation}")
else:
take_snapshot_for_operation(name, operation, tag)
def update_snapshot_for_current_operation(name: str, tag: str) -> None: