diff --git a/backend/app/db/functions/recommendations_functions.py b/backend/app/db/functions/recommendations_functions.py index 2fdb6142..620ec059 100644 --- a/backend/app/db/functions/recommendations_functions.py +++ b/backend/app/db/functions/recommendations_functions.py @@ -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