diff --git a/api/s6_pumps.py b/api/s6_pumps.py index 1f9dce8..1bdbef9 100644 --- a/api/s6_pumps.py +++ b/api/s6_pumps.py @@ -175,9 +175,12 @@ def inp_out_pump(name: str) -> list[str]: def unset_pump_by_curve(name: str, curve: str) -> ChangeSet: cs = ChangeSet() - rows = read_all(name, f"select id from pumps where head = '{curve}'") + rows = read_all(name, f"select * from pumps where head = '{curve}'") for row in rows: - cs.append(g_update_prefix | {'type': 'pump', 'id': row['id'], 'head': None}) + if row['power'] != None: + cs.append(g_update_prefix | {'type': 'pump', 'id': row['id'], 'head': None}) + else: # workaround to prevent pump deletion... and I don't want to remove constraint... + cs.append(g_update_prefix | {'type': 'pump', 'id': row['id'], 'head': None, 'power': 0.0}) return cs