Compare commits
2 Commits
f20d86db41
...
521ac1dcbd
| Author | SHA1 | Date |
|---|---|---|
|
|
521ac1dcbd | |
|
|
843691c571 |
|
|
@ -59,7 +59,7 @@ def create_kpi_setting():
|
|||
position=data["position"],
|
||||
active=data["active"],
|
||||
examples=data.get("examples", []),
|
||||
is_trained=False
|
||||
is_trained=False,
|
||||
)
|
||||
|
||||
db.session.add(new_kpi_setting)
|
||||
|
|
@ -104,6 +104,9 @@ def update_kpi_setting(id):
|
|||
if "examples" in data:
|
||||
kpi_setting.examples = data["examples"]
|
||||
|
||||
if "is_trained" in data:
|
||||
kpi_setting.is_trained = data["is_trained"]
|
||||
|
||||
db.session.commit()
|
||||
|
||||
return jsonify(kpi_setting.to_dict()), 200
|
||||
|
|
|
|||
|
|
@ -131,7 +131,15 @@ def update_training_status():
|
|||
db.session.commit()
|
||||
except Exception as e:
|
||||
db.session.rollback()
|
||||
return jsonify({"error": "is_trained konnte nicht aktualisiert werden", "details": str(e)}), 500
|
||||
return (
|
||||
jsonify(
|
||||
{
|
||||
"error": "is_trained konnte nicht aktualisiert werden",
|
||||
"details": str(e),
|
||||
}
|
||||
),
|
||||
500,
|
||||
)
|
||||
|
||||
return jsonify({"status": "success", "running": current_training_status["running"]})
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ class KPISettingModel(db.Model):
|
|||
examples: Mapped[list] = mapped_column(JSONB, default=[])
|
||||
is_trained: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
|
||||
def to_dict(self):
|
||||
return OrderedDict(
|
||||
[
|
||||
|
|
@ -44,7 +43,9 @@ class KPISettingModel(db.Model):
|
|||
]
|
||||
)
|
||||
|
||||
def __init__(self, name, mandatory, type, position, active, examples=None, is_trained=False):
|
||||
def __init__(
|
||||
self, name, mandatory, type, position, active, examples=None, is_trained=False
|
||||
):
|
||||
self.name = name
|
||||
self.mandatory = mandatory
|
||||
self.type = type
|
||||
|
|
|
|||
|
|
@ -289,4 +289,3 @@ def seed_default_kpi_settings():
|
|||
db.session.rollback()
|
||||
print(f"Fehler beim Hinzufügen der Standard KPI Settings: {e}")
|
||||
raise
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue