fix(kaya): lock Fred & Felia kcal/100g (always 115)
This commit is contained in:
parent
19592f2230
commit
68d5527a89
@ -2239,11 +2239,13 @@ const CALCULATOR_CONFIG = {
|
||||
state.foodSources.forEach(saved => {
|
||||
// Back-compat: older Kaya state stored Fred & Felia as `chartType: "gc"`.
|
||||
const chartType = saved.chartType === 'gc' ? 'mer' : (saved.chartType || null);
|
||||
const normalizedEnergy = chartType === 'mer' ? '115' : (saved.energy || '');
|
||||
const normalizedEnergyUnit = chartType === 'mer' ? 'kcal100g' : (saved.energyUnit || 'kcal100g');
|
||||
const fs = {
|
||||
id: saved.id || this.generateFoodSourceId(),
|
||||
name: saved.name || 'Food Source',
|
||||
energy: saved.energy || '',
|
||||
energyUnit: saved.energyUnit || 'kcal100g',
|
||||
energy: normalizedEnergy,
|
||||
energyUnit: normalizedEnergyUnit,
|
||||
percentage: typeof saved.percentage === 'number' ? saved.percentage : 0,
|
||||
isLocked: !!saved.isLocked,
|
||||
chartType: chartType,
|
||||
@ -2796,7 +2798,7 @@ const CALCULATOR_CONFIG = {
|
||||
const container = document.getElementById('foodSources');
|
||||
if (!container) return;
|
||||
|
||||
const isChart = foodSource.chartType === 'kibble';
|
||||
const isChart = foodSource.chartType === 'kibble' || foodSource.chartType === 'mer';
|
||||
const energyReadonlyAttr = isChart ? 'readonly' : '';
|
||||
const energyTitle = isChart ? 'Chart-based food: kcal locked' : 'Enter energy content';
|
||||
const unitDisabledAttr = isChart ? 'disabled' : '';
|
||||
|
||||
@ -131,11 +131,13 @@
|
||||
state.foodSources.forEach(saved => {
|
||||
// Back-compat: older Kaya state stored Fred & Felia as `chartType: "gc"`.
|
||||
const chartType = saved.chartType === 'gc' ? 'mer' : (saved.chartType || null);
|
||||
const normalizedEnergy = chartType === 'mer' ? '115' : (saved.energy || '');
|
||||
const normalizedEnergyUnit = chartType === 'mer' ? 'kcal100g' : (saved.energyUnit || 'kcal100g');
|
||||
const fs = {
|
||||
id: saved.id || this.generateFoodSourceId(),
|
||||
name: saved.name || 'Food Source',
|
||||
energy: saved.energy || '',
|
||||
energyUnit: saved.energyUnit || 'kcal100g',
|
||||
energy: normalizedEnergy,
|
||||
energyUnit: normalizedEnergyUnit,
|
||||
percentage: typeof saved.percentage === 'number' ? saved.percentage : 0,
|
||||
isLocked: !!saved.isLocked,
|
||||
chartType: chartType,
|
||||
@ -688,7 +690,7 @@
|
||||
const container = document.getElementById('foodSources');
|
||||
if (!container) return;
|
||||
|
||||
const isChart = foodSource.chartType === 'kibble';
|
||||
const isChart = foodSource.chartType === 'kibble' || foodSource.chartType === 'mer';
|
||||
const energyReadonlyAttr = isChart ? 'readonly' : '';
|
||||
const energyTitle = isChart ? 'Chart-based food: kcal locked' : 'Enter energy content';
|
||||
const unitDisabledAttr = isChart ? 'disabled' : '';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user