From 6afd6c34112a108aa6b674cd28af4ea9c11e46db Mon Sep 17 00:00:00 2001 From: "WQY\\qiong" Date: Fri, 21 Oct 2022 19:59:58 +0800 Subject: [PATCH] Fix delete junction batch command --- api/command.py | 2 +- api/operation.py | 1 + tjnetwork.py | 5 ----- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/api/command.py b/api/command.py index c7fbeb4..4c7bc0c 100644 --- a/api/command.py +++ b/api/command.py @@ -51,7 +51,7 @@ def execute_delete_command(name: str, cs: ChangeSet) -> ChangeSet: type = cs.operations[0]['type'] if type == JUNCTION: - return add_junction(name, cs) + return delete_junction(name, cs) elif type == RESERVOIR: return delete_reservoir(name, cs) elif type == TANK: diff --git a/api/operation.py b/api/operation.py index b84898d..79a3a3b 100644 --- a/api/operation.py +++ b/api/operation.py @@ -55,6 +55,7 @@ def write(name: str, sql: str) -> None: with conn[name].cursor() as cur: cur.execute(sql) + def get_current_operation(name: str) -> int: return int(read(name, 'select id from current_operation')['id']) diff --git a/tjnetwork.py b/tjnetwork.py index 822bd2b..58fbcf0 100644 --- a/tjnetwork.py +++ b/tjnetwork.py @@ -96,11 +96,6 @@ def pick_snapshot(name: str, tag: str, discard: bool = False) -> ChangeSet: def sync_with_server(name: str, operation: int) -> ChangeSet: return api.sync_with_server(name, operation) - -############################################################ -# operation -############################################################ - def execute_batch_commands(name: str, cs: ChangeSet) -> ChangeSet: return api.execute_batch_commands(name, cs)