mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
also update scenario when updating plan
This commit is contained in:
parent
f34a6269f7
commit
61d9e64e1b
1 changed files with 10 additions and 2 deletions
|
|
@ -639,6 +639,14 @@ def update_plan(plan_model: PlanModel, scenario_model: ScenarioModel) -> bool:
|
||||||
.where(PlanModel.id == plan_model.id)
|
.where(PlanModel.id == plan_model.id)
|
||||||
.values(**plan_model.model_dump(exclude={"id"}, exclude_unset=True))
|
.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()
|
session.commit()
|
||||||
return result.rowcount > 0
|
return plan_result.rowcount > 0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue