diff --git a/backend/data_layer/recovery_metrics.py b/backend/data_layer/recovery_metrics.py index cf7ced0..820605d 100644 --- a/backend/data_layer/recovery_metrics.py +++ b/backend/data_layer/recovery_metrics.py @@ -227,9 +227,11 @@ def get_rest_days_data( { "total_rest_days": int, "rest_types": { - "strength": int, - "cardio": int, - "relaxation": int + "muscle_recovery": int, + "cardio_recovery": int, + "mental_rest": int, + "deload": int, + "injury": int }, "rest_frequency": float, # days per week "confidence": str, @@ -253,25 +255,27 @@ def get_rest_days_data( total_row = cur.fetchone() total_count = total_row['count'] if total_row else 0 - # Get breakdown by rest type + # Get breakdown by focus type cur.execute( - """SELECT rest_type, COUNT(*) as count FROM rest_days + """SELECT focus, COUNT(*) as count FROM rest_days WHERE profile_id=%s AND date >= %s - GROUP BY rest_type""", + GROUP BY focus""", (profile_id, cutoff) ) type_rows = cur.fetchall() rest_types = { - "strength": 0, - "cardio": 0, - "relaxation": 0 + "muscle_recovery": 0, + "cardio_recovery": 0, + "mental_rest": 0, + "deload": 0, + "injury": 0 } for row in type_rows: - rest_type = row['rest_type'] - if rest_type in rest_types: - rest_types[rest_type] = row['count'] + focus = row['focus'] + if focus in rest_types: + rest_types[focus] = row['count'] # Calculate frequency (rest days per week) rest_frequency = (total_count / days * 7) if days > 0 else 0.0