This commit is contained in:
Mateusz Gruszczyński
2026-06-16 22:45:44 +02:00
parent d5fa689dad
commit 03ce088d24
9 changed files with 29 additions and 6 deletions
+16
View File
@@ -218,6 +218,22 @@ def ratio_groups_save():
@bp.delete("/ratio-groups/<int:group_id>")
def ratio_groups_delete(group_id: int):
profile = request_profile()
if not profile:
return jsonify({"ok": False, "error": "No profile"}), 400
if not auth.can_write_profile(int(profile["id"]), default_user_id()):
return jsonify({"ok": False, "error": "No write access to profile"}), 403
with connect() as conn:
# Note: Deleting a ratio group removes only the group definition and its assignment links; history stays as an audit trail.
deleted = conn.execute("DELETE FROM ratio_groups WHERE id=? AND profile_id=?", (int(group_id), int(profile["id"]))).rowcount
conn.execute("DELETE FROM ratio_assignments WHERE group_id=? AND profile_id=?", (int(group_id), int(profile["id"])))
if not deleted:
return jsonify({"ok": False, "error": "Ratio group not found"}), 404
return ratio_groups_list()
@bp.post("/ratio-groups/check")
def ratio_groups_check():
profile = request_profile()