From 1fdf91cb502806d542af49cc0736f69ccce7b00e Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 27 Mar 2026 10:56:53 +0100 Subject: [PATCH] fix: Migration 027 - health mode missing dimensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- backend/migrations/027_focus_areas_system.sql | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/backend/migrations/027_focus_areas_system.sql b/backend/migrations/027_focus_areas_system.sql index aae9dd1..4e7fac8 100644 --- a/backend/migrations/027_focus_areas_system.sql +++ b/backend/migrations/027_focus_areas_system.sql @@ -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