fix: Phase 0b - activity duration column in health_stability_score
This commit is contained in:
1 parent
10ea560fcf
commit
91bafc6af1
1 file changed
+2
-2
@@ -232,7 +232,7 @@ def calculate_health_stability_score(profile_id: str) -> Optional[int]:
|
|||||||
|
|
||||||
# 3. Movement baseline (20%)
|
# 3. Movement baseline (20%)
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
SELECT duration
|
SELECT duration_min
|
||||||
FROM activity_log
|
FROM activity_log
|
||||||
WHERE profile_id = %s
|
WHERE profile_id = %s
|
||||||
AND date >= CURRENT_DATE - INTERVAL '7 days'
|
AND date >= CURRENT_DATE - INTERVAL '7 days'
|
||||||
@@ -240,7 +240,7 @@ def calculate_health_stability_score(profile_id: str) -> Optional[int]:
|
|||||||
|
|
||||||
activities = cur.fetchall()
|
activities = cur.fetchall()
|
||||||
if activities:
|
if activities:
|
||||||
total_minutes = sum(a['duration'] for a in activities)
|
total_minutes = sum(a['duration_min'] for a in activities)
|
||||||
# WHO recommends 150-300 min/week moderate activity
|
# WHO recommends 150-300 min/week moderate activity
|
||||||
movement_score = min(100, (total_minutes / 150) * 100)
|
movement_score = min(100, (total_minutes / 150) * 100)
|
||||||
components.append(('movement', movement_score, 20))
|
components.append(('movement', movement_score, 20))
|
||||||
|
|||||||
Reference in new issue
Block a user