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