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
Showing only changes of commit 26110d44b4 - Show all commits

View File

@ -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