Flexibles KI Prompt System #48
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user