Workaround to prevent pump (cascade) deletion...
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user