fix: nutrition coverage double-counting excluded ingredients

Excluded (manually disregarded) ingredients were incrementing the total
count twice — once in the loop body and again in the exclusion check —
deflating the displayed coverage percentage.
This commit is contained in:
2026-04-03 09:00:24 +02:00
parent 88f3909634
commit d462a6ae1b

View File

@@ -274,7 +274,7 @@ export function createNutritionCalculator(
total++;
const m = mappingIndex.get(`${ing.sectionIndex}-${ing.ingredientIndex}`);
// Manually excluded ingredients count as covered
if (m?.excluded) { total++; mapped++; continue; }
if (m?.excluded) { mapped++; continue; }
if (m && m.matchMethod !== 'none') mapped++;
}
return total > 0 ? mapped / total : 1;