diff --git a/backend/placeholder_resolver.py b/backend/placeholder_resolver.py index b734eea..985b522 100644 --- a/backend/placeholder_resolver.py +++ b/backend/placeholder_resolver.py @@ -666,8 +666,9 @@ def _get_active_goals_json(profile_id: str) -> str: """Get active goals as JSON string""" import json try: - # TODO: Implement after goal_utils extensions - return '[]' + from goal_utils import get_active_goals + goals = get_active_goals(profile_id) + return json.dumps(goals, default=str) except Exception: return '[]' @@ -676,8 +677,36 @@ def _get_focus_areas_weighted_json(profile_id: str) -> str: """Get focus areas with weights as JSON string""" import json try: - # TODO: Implement after goal_utils extensions - return '[]' + from goal_utils import get_focus_weights_v2, get_db, get_cursor + + weights = get_focus_weights_v2(get_db(), profile_id) + + # Get focus area details + with get_db() as conn: + cur = get_cursor(conn) + cur.execute(""" + SELECT area_key, name_de, name_en, category + FROM focus_area_definitions + WHERE is_active = true + """) + definitions = {row['area_key']: row for row in cur.fetchall()} + + # Build weighted list + result = [] + for area_key, weight in weights.items(): + if weight > 0 and area_key in definitions: + area = definitions[area_key] + result.append({ + 'key': area_key, + 'name': area['name_de'], + 'category': area['category'], + 'weight': weight + }) + + # Sort by weight descending + result.sort(key=lambda x: x['weight'], reverse=True) + + return json.dumps(result, default=str) except Exception: return '[]'