From d462a6ae1b69b717f3e11e9f3dafc23cce2ee2cb Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 3 Apr 2026 09:00:24 +0200 Subject: [PATCH] fix: nutrition coverage double-counting excluded ingredients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/lib/js/nutrition.svelte.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/js/nutrition.svelte.ts b/src/lib/js/nutrition.svelte.ts index f402e60..b8242ae 100644 --- a/src/lib/js/nutrition.svelte.ts +++ b/src/lib/js/nutrition.svelte.ts @@ -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;