From 8da55652e0137cb11c9b723448d4643e130203d0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 20 May 2026 17:05:18 +0200 Subject: [PATCH] Keep plan title consistent across versions All generated and tuned plans now share the title "Weight-loss plan" with version number tracked separately, matching the PlansPage display which already shows "Version N" beneath the title. Co-Authored-By: Claude Sonnet 4.6 --- web/src/App.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/src/App.svelte b/web/src/App.svelte index 6216845..634aba9 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -745,7 +745,8 @@ { role: 'user', content: `Create a personalized weight-loss plan using these details: height ${settings.heightCm} cm, current weight ${settings.weightKg} kg, target weight ${settings.targetWeightKg || 'not set'} kg, activity ${settings.activityLevel}, pace ${settings.pace}. Include daily calorie range, protein target, habits, weekly review steps, and safety notes. Recent meals: ${entries.slice(-10).map(entry => `${entry.date} ${entry.mealType}: ${entry.mealName || entry.description}, ${entry.calories || 0} kcal`).join('; ') || 'none logged yet'}.` }, ], }); - const plan = { id: entryId(), title: `Weight-loss plan ${plans.length + 1}`, version: plans.length + 1, content, createdAt: new Date().toISOString() }; + const version = Math.max(0, ...plans.map(p => Number(p.version || 0))) + 1; + const plan = { id: entryId(), title: 'Weight-loss plan', version, content, createdAt: new Date().toISOString() }; await savePlan(plan); planStatus = 'Plan generated.'; } catch (error) { @@ -777,7 +778,7 @@ ], }); const version = Math.max(0, ...plans.map(plan => Number(plan.version || 0))) + 1; - const updatedPlan = { id: entryId(), title: `Updated plan ${version}`, version, content, createdAt: new Date().toISOString(), previousPlanId: currentPlan.id }; + const updatedPlan = { id: entryId(), title: 'Weight-loss plan', version, content, createdAt: new Date().toISOString(), previousPlanId: currentPlan.id }; await savePlan(updatedPlan); tuneNote = ''; planStatus = 'Plan updated.';