fix: Migration 027 - health mode missing dimensions
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:
1 parent
80d57918ae
commit
1fdf91cb50
1 file changed
+19
-28
@@ -57,10 +57,10 @@ INSERT INTO focus_areas (
|
||||
SELECT
|
||||
id AS profile_id,
|
||||
CASE goal_mode
|
||||
WHEN 'weight_loss' THEN 60 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'recomposition' THEN 30 ELSE 0
|
||||
WHEN 'weight_loss' THEN 60
|
||||
WHEN 'recomposition' THEN 30
|
||||
WHEN 'health' THEN 5
|
||||
ELSE 0
|
||||
END AS weight_loss_pct,
|
||||
|
||||
CASE goal_mode
|
||||
@@ -71,23 +71,19 @@ SELECT
|
||||
END AS muscle_gain_pct,
|
||||
|
||||
CASE goal_mode
|
||||
WHEN 'strength' THEN 50 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'recomposition' THEN 25 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'weight_loss' THEN 10 ELSE 0
|
||||
WHEN 'strength' THEN 50
|
||||
WHEN 'recomposition' THEN 25
|
||||
WHEN 'weight_loss' THEN 10
|
||||
WHEN 'health' THEN 10
|
||||
ELSE 0
|
||||
END AS strength_pct,
|
||||
|
||||
CASE goal_mode
|
||||
WHEN 'endurance' THEN 70 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'recomposition' THEN 10 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'weight_loss' THEN 20 ELSE 0
|
||||
WHEN 'endurance' THEN 70
|
||||
WHEN 'recomposition' THEN 10
|
||||
WHEN 'weight_loss' THEN 20
|
||||
WHEN 'health' THEN 20
|
||||
ELSE 0
|
||||
END AS endurance_pct,
|
||||
|
||||
CASE goal_mode
|
||||
@@ -104,16 +100,11 @@ SELECT
|
||||
END AS flexibility_pct,
|
||||
|
||||
CASE goal_mode
|
||||
WHEN 'health' THEN 55 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'endurance' THEN 20 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'strength' THEN 10 ELSE 0
|
||||
END +
|
||||
CASE goal_mode
|
||||
WHEN 'weight_loss' THEN 5 ELSE 0
|
||||
WHEN 'health' THEN 50
|
||||
WHEN 'endurance' THEN 20
|
||||
WHEN 'strength' THEN 10
|
||||
WHEN 'weight_loss' THEN 5
|
||||
ELSE 0
|
||||
END AS health_pct
|
||||
FROM profiles
|
||||
WHERE goal_mode IS NOT NULL
|
||||
|
||||
Reference in new issue
Block a user