Make use of utility decorate

This commit is contained in:
wqy
2022-09-17 10:11:47 +08:00
parent 4761a0d60b
commit 62961cba70

View File

@@ -33,9 +33,8 @@ def delete_tank(name: str, id: str) -> ChangeSet:
max_level = row['max_level']
diameter = row['diameter']
min_vol = row['min_vol']
vol_curve = 'NULL' if row['vol_curve'] == None else row['vol_curve']
vol_curve = f'"{vol_curve}"' if vol_curve != 'NULL' else vol_curve
overflow = 'NULL' if row['overflow'] == None else row['overflow']
vol_curve = utility.decorate(row['vol_curve'], 'str', True)
overflow = utility.decorate(row['overflow'], 'str', True)
sql += f"delete from tanks where id = '{id}';"
undo_sql = f'insert into tanks (id, elevation, init_level, min_level, max_level, diameter, min_vol, vol_curve, overflow) values ("{id}", {elevation}, {init_level}, {min_level}, {max_level}, {diameter}, {min_vol}, {vol_curve}, {overflow});'