Weitere Änderungen gespeichert
parent
6c55150e9c
commit
843691c571
|
|
@ -59,7 +59,7 @@ def create_kpi_setting():
|
||||||
position=data["position"],
|
position=data["position"],
|
||||||
active=data["active"],
|
active=data["active"],
|
||||||
examples=data.get("examples", []),
|
examples=data.get("examples", []),
|
||||||
is_trained=False
|
is_trained=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
db.session.add(new_kpi_setting)
|
db.session.add(new_kpi_setting)
|
||||||
|
|
@ -104,6 +104,9 @@ def update_kpi_setting(id):
|
||||||
if "examples" in data:
|
if "examples" in data:
|
||||||
kpi_setting.examples = data["examples"]
|
kpi_setting.examples = data["examples"]
|
||||||
|
|
||||||
|
if "is_trained" in data:
|
||||||
|
kpi_setting.is_trained = data["is_trained"]
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return jsonify(kpi_setting.to_dict()), 200
|
return jsonify(kpi_setting.to_dict()), 200
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,15 @@ def update_training_status():
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
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"]})
|
return jsonify({"status": "success", "running": current_training_status["running"]})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ class KPISettingModel(db.Model):
|
||||||
examples: Mapped[list] = mapped_column(JSONB, default=[])
|
examples: Mapped[list] = mapped_column(JSONB, default=[])
|
||||||
is_trained: Mapped[bool] = mapped_column(default=False)
|
is_trained: Mapped[bool] = mapped_column(default=False)
|
||||||
|
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return OrderedDict(
|
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.name = name
|
||||||
self.mandatory = mandatory
|
self.mandatory = mandatory
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
|
||||||
|
|
@ -289,4 +289,3 @@ def seed_default_kpi_settings():
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
print(f"Fehler beim Hinzufügen der Standard KPI Settings: {e}")
|
print(f"Fehler beim Hinzufügen der Standard KPI Settings: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue