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 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-05-20 17:05:18 +02:00
parent 40e65ca70c
commit 8da55652e0

View file

@ -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.';