Return empty change set

This commit is contained in:
wqy
2022-09-17 18:31:00 +08:00
parent a72115e15f
commit b52515b26f
8 changed files with 47 additions and 50 deletions

View File

@@ -17,11 +17,11 @@ def _get_junction(name: str, id: str) -> Row | None:
def delete_junction(name: str, id: str) -> ChangeSet:
if not is_junction(name, id):
return
return ChangeSet()
row = _get_junction(name, id)
if row == None:
return
return ChangeSet()
elevation = row['elevation']
demand = utility.decorate(row['demand'], 'float', True)
@@ -60,11 +60,11 @@ def get_junction_coord(name: str, id: str) -> dict[str, float] | None:
def _set_junction(name: str, id: str, key: str, key_type: str, value: str, optional: bool = False) -> ChangeSet:
if not is_junction(name, id):
return
return ChangeSet()
row = _get_junction(name, id)
if row == None:
return
return ChangeSet()
return utility.update(name, JUNCTION, 'junctions', 'id', id, key, key_type, row[key], value, optional)