Compare commits
No commits in common. "521ac1dcbd6521ecd767bd2d6b0f00e7190efc0b" and "f20d86db416a44d2bf0879a1053b06664d11c819" have entirely different histories.
521ac1dcbd
...
f20d86db41
|
|
@ -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,9 +104,6 @@ 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,15 +131,7 @@ 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 (
|
return jsonify({"error": "is_trained konnte nicht aktualisiert werden", "details": str(e)}), 500
|
||||||
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,6 +29,7 @@ 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(
|
||||||
[
|
[
|
||||||
|
|
@ -43,9 +44,7 @@ class KPISettingModel(db.Model):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, name, mandatory, type, position, active, examples=None, is_trained=False):
|
||||||
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,3 +289,4 @@ 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