Enhance step data handling in Database class by adding ordering and restructuring data appending

This commit is contained in:
Théophile Diot 2025-01-14 14:41:58 +01:00
parent 9300d1b4d6
commit fa48dda8e9
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -3643,13 +3643,14 @@ class Database:
session.query(Template_steps)
.with_entities(Template_steps.id, Template_steps.title, Template_steps.subtitle)
.filter_by(template_id=template.id)
.order_by(Template_steps.id)
):
templates[template.id]["steps"].append({"title": step.title, "subtitle": step.subtitle})
step_data = {"title": step.title, "subtitle": step.subtitle}
if step.id in steps_settings:
templates[template.id]["steps"][step.id - 1]["settings"] = steps_settings[step.id]
step_data["settings"] = steps_settings[step.id]
if step.id in steps_configs:
templates[template.id]["steps"][step.id - 1]["configs"] = steps_configs[step.id]
step_data["configs"] = steps_configs[step.id]
templates[template.id]["steps"].append(step_data)
return templates