From 62961cba70f1496ae0cdeb6270fabfa25b7a16e4 Mon Sep 17 00:00:00 2001 From: wqy Date: Sat, 17 Sep 2022 10:11:47 +0800 Subject: [PATCH] Make use of utility decorate --- api/s4_tanks.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/s4_tanks.py b/api/s4_tanks.py index f21f66c..c4283a5 100644 --- a/api/s4_tanks.py +++ b/api/s4_tanks.py @@ -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});'