Goals -System refactored - Platzhaltersystem enhanced (als draft) #53

Merged
Lars merged 86 commits from develop into main 2026-03-31 11:46:48 +02:00
3 changed files with 4 additions and 4 deletions
Showing only changes of commit b230a03fdd - Show all commits

View File

@ -207,8 +207,8 @@ def calculate_health_stability_score(profile_id: str) -> Optional[int]:
SELECT systolic, diastolic
FROM blood_pressure_log
WHERE profile_id = %s
AND date >= CURRENT_DATE - INTERVAL '28 days'
ORDER BY date DESC
AND measured_at >= CURRENT_DATE - INTERVAL '28 days'
ORDER BY measured_at DESC
""", (profile_id,))
bp_readings = cur.fetchall()

View File

@ -526,7 +526,7 @@ def get_active_goals(profile_id: str) -> List[Dict]:
with get_db() as conn:
cur = get_cursor(conn)
cur.execute("""
SELECT id, goal_type, target_value, target_date,
SELECT id, goal_type, name, target_value, target_date,
current_value, progress_pct, status, is_primary
FROM goals
WHERE profile_id = %s

View File

@ -595,7 +595,7 @@ def _safe_str(func_name: str, profile_id: str) -> str:
from calculations import body_metrics, nutrition_metrics, activity_metrics, scores, correlation_metrics
func_map = {
'top_goal_name': lambda pid: scores.get_top_priority_goal(pid)['name'] if scores.get_top_priority_goal(pid) else None,
'top_goal_name': lambda pid: (scores.get_top_priority_goal(pid).get('name') or scores.get_top_priority_goal(pid).get('goal_type')) if scores.get_top_priority_goal(pid) else None,
'top_goal_status': lambda pid: scores.get_top_priority_goal(pid)['status'] if scores.get_top_priority_goal(pid) else None,
'top_focus_area_name': lambda pid: scores.get_top_focus_area(pid)['label'] if scores.get_top_focus_area(pid) else None,
'recomposition_quadrant': body_metrics.calculate_recomposition_quadrant,