fix: Migration 027 - health mode missing dimensions
All checks were successful
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s

Fixed health mode calculation to include all 6 dimensions.
Simplified CASE statements (single CASE instead of multiple additions).

Before: health mode only set flexibility (15%) + health (55%) = 70% 
After:  health mode sets all dimensions = 100% 
  - weight_loss: 5%
  - muscle_gain: 0%
  - strength: 10%
  - endurance: 20%
  - flexibility: 15%
  - health: 50%

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-27 10:56:53 +01:00
parent 80d57918ae
commit 1fdf91cb50

View File

@ -57,10 +57,10 @@ INSERT INTO focus_areas (
SELECT SELECT
id AS profile_id, id AS profile_id,
CASE goal_mode CASE goal_mode
WHEN 'weight_loss' THEN 60 ELSE 0 WHEN 'weight_loss' THEN 60
END + WHEN 'recomposition' THEN 30
CASE goal_mode WHEN 'health' THEN 5
WHEN 'recomposition' THEN 30 ELSE 0 ELSE 0
END AS weight_loss_pct, END AS weight_loss_pct,
CASE goal_mode CASE goal_mode
@ -71,23 +71,19 @@ SELECT
END AS muscle_gain_pct, END AS muscle_gain_pct,
CASE goal_mode CASE goal_mode
WHEN 'strength' THEN 50 ELSE 0 WHEN 'strength' THEN 50
END + WHEN 'recomposition' THEN 25
CASE goal_mode WHEN 'weight_loss' THEN 10
WHEN 'recomposition' THEN 25 ELSE 0 WHEN 'health' THEN 10
END + ELSE 0
CASE goal_mode
WHEN 'weight_loss' THEN 10 ELSE 0
END AS strength_pct, END AS strength_pct,
CASE goal_mode CASE goal_mode
WHEN 'endurance' THEN 70 ELSE 0 WHEN 'endurance' THEN 70
END + WHEN 'recomposition' THEN 10
CASE goal_mode WHEN 'weight_loss' THEN 20
WHEN 'recomposition' THEN 10 ELSE 0 WHEN 'health' THEN 20
END + ELSE 0
CASE goal_mode
WHEN 'weight_loss' THEN 20 ELSE 0
END AS endurance_pct, END AS endurance_pct,
CASE goal_mode CASE goal_mode
@ -104,16 +100,11 @@ SELECT
END AS flexibility_pct, END AS flexibility_pct,
CASE goal_mode CASE goal_mode
WHEN 'health' THEN 55 ELSE 0 WHEN 'health' THEN 50
END + WHEN 'endurance' THEN 20
CASE goal_mode WHEN 'strength' THEN 10
WHEN 'endurance' THEN 20 ELSE 0 WHEN 'weight_loss' THEN 5
END + ELSE 0
CASE goal_mode
WHEN 'strength' THEN 10 ELSE 0
END +
CASE goal_mode
WHEN 'weight_loss' THEN 5 ELSE 0
END AS health_pct END AS health_pct
FROM profiles FROM profiles
WHERE goal_mode IS NOT NULL WHERE goal_mode IS NOT NULL