Goalsystem V1 #50

Merged
Lars merged 51 commits from develop into main 2026-03-27 17:40:51 +01:00
2 changed files with 4 additions and 10 deletions
Showing only changes of commit a039a0fad3 - Show all commits

View File

@ -36,9 +36,7 @@ CREATE TABLE IF NOT EXISTS goal_type_definitions (
-- Audit
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW(),
created_by UUID REFERENCES profiles(id) ON DELETE SET NULL,
updated_by UUID REFERENCES profiles(id) ON DELETE SET NULL
updated_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_goal_type_definitions_active ON goal_type_definitions(is_active) WHERE is_active = true;

View File

@ -572,16 +572,14 @@ def create_goal_type_definition(
INSERT INTO goal_type_definitions (
type_key, label_de, label_en, unit, icon, category,
source_table, source_column, aggregation_method,
calculation_formula, description, is_active, is_system,
created_by, updated_by
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
calculation_formula, description, is_active, is_system
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
RETURNING id
""", (
data.type_key, data.label_de, data.label_en, data.unit, data.icon,
data.category, data.source_table, data.source_column,
data.aggregation_method, data.calculation_formula, data.description,
True, False, # is_active=True, is_system=False
pid, pid
True, False # is_active=True, is_system=False
))
goal_type_id = cur.fetchone()['id']
@ -677,8 +675,6 @@ def update_goal_type_definition(
raise HTTPException(status_code=400, detail="Keine Änderungen angegeben")
updates.append("updated_at = NOW()")
updates.append("updated_by = %s")
params.append(pid)
params.append(goal_type_id)
cur.execute(