Flexibles KI Prompt System #48

Merged
Lars merged 56 commits from develop into main 2026-03-26 14:49:48 +01:00
Showing only changes of commit a43a9f129f - Show all commits

View File

@ -347,7 +347,8 @@ def get_sleep_avg_quality(profile_id: str, days: int = 7) -> str:
for row in rows:
segments = row['sleep_segments']
if segments:
deep_rem_min = sum(s.get('duration_min', 0) for s in segments if s.get('stage') in ['Deep', 'REM'])
# Note: stages are stored lowercase (deep, rem, light, awake)
deep_rem_min = sum(s.get('duration_min', 0) for s in segments if s.get('stage') in ['deep', 'rem'])
total_min = sum(s.get('duration_min', 0) for s in segments)
if total_min > 0:
quality_pct = (deep_rem_min / total_min) * 100