also update scenario when updating plan

This commit is contained in:
Daniel Roth 2026-02-13 09:44:35 +00:00
parent f34a6269f7
commit 61d9e64e1b

View file

@ -639,6 +639,14 @@ def update_plan(plan_model: PlanModel, scenario_model: ScenarioModel) -> bool:
.where(PlanModel.id == plan_model.id)
.values(**plan_model.model_dump(exclude={"id"}, exclude_unset=True))
)
result = session.exec(stmt)
plan_result = session.exec(stmt)
scenario_stmt = (
update(ScenarioModel)
.where(ScenarioModel.id == scenario_model.id)
.values(**scenario_model.model_dump(exclude={"id"}, exclude_unset=True))
)
session.exec(scenario_stmt)
session.commit()
return result.rowcount > 0
return plan_result.rowcount > 0