From 29b121a0ac354af0f2df2db59707167781886bea Mon Sep 17 00:00:00 2001 From: Michael Genson <71845777+michael-genson@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:24:29 +0000 Subject: [PATCH] remove foods/units from parser if they're invalid --- .../r/[slug]/ingredient-parser.vue | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/frontend/pages/g/[groupSlug]/r/[slug]/ingredient-parser.vue b/frontend/pages/g/[groupSlug]/r/[slug]/ingredient-parser.vue index b2d96b7e0..03aa1c3ea 100644 --- a/frontend/pages/g/[groupSlug]/r/[slug]/ingredient-parser.vue +++ b/frontend/pages/g/[groupSlug]/r/[slug]/ingredient-parser.vue @@ -228,19 +228,19 @@ export default defineNuxtComponent({ let unitErrorMessage = ""; let foodErrorMessage = ""; - if (unitError || foodError) { - if (unitError) { - if (ing?.ingredient?.unit?.name) { - const unit = ing.ingredient.unit.name || i18n.t("recipe.parser.no-unit"); - unitErrorMessage = i18n.t("recipe.parser.missing-unit", { unit }).toString(); - } + if (unitError) { + if (ing?.ingredient?.unit?.name) { + const unit = ing.ingredient.unit.name || i18n.t("recipe.parser.no-unit"); + ing.ingredient.unit = undefined; + unitErrorMessage = i18n.t("recipe.parser.missing-unit", { unit }).toString(); } + } - if (foodError) { - if (ing?.ingredient?.food?.name) { - const food = ing.ingredient.food.name || i18n.t("recipe.parser.no-food"); - foodErrorMessage = i18n.t("recipe.parser.missing-food", { food }).toString(); - } + if (foodError) { + if (ing?.ingredient?.food?.name) { + const food = ing.ingredient.food.name || i18n.t("recipe.parser.no-food"); + ing.ingredient.food = undefined; + foodErrorMessage = i18n.t("recipe.parser.missing-food", { food }).toString(); } } panels.value.push(index);