diff --git a/frontend/composables/recipes/use-recipe-ingredients.test.ts b/frontend/composables/recipes/use-recipe-ingredients.test.ts index 7850dca1d877..73d163e48409 100644 --- a/frontend/composables/recipes/use-recipe-ingredients.test.ts +++ b/frontend/composables/recipes/use-recipe-ingredients.test.ts @@ -118,4 +118,14 @@ describe(parseIngredientText.name, () => { expect(parseIngredientText(ingredient, false)).toEqual("diced onions"); }); + + test("plural test : single qty, scaled", () => { + const ingredient = createRecipeIngredient({ + quantity: 1, + unit: { id: "1", name: "tablespoon", pluralName: "tablespoons", abbreviation: "tbsp", pluralAbbreviation: "tbsps", useAbbreviation: false }, + food: { id: "1", name: "diced onion", pluralName: "diced onions" } + }); + + expect(parseIngredientText(ingredient, false, 2)).toEqual("2 tablespoons diced onions"); + }); }); diff --git a/frontend/composables/recipes/use-recipe-ingredients.ts b/frontend/composables/recipes/use-recipe-ingredients.ts index 6db7f2fe30de..a31872652fa5 100644 --- a/frontend/composables/recipes/use-recipe-ingredients.ts +++ b/frontend/composables/recipes/use-recipe-ingredients.ts @@ -46,8 +46,8 @@ export function useParsedIngredientText(ingredient: RecipeIngredient, disableAmo } const { quantity, food, unit, note } = ingredient; - const usePluralUnit = quantity !== undefined && quantity > 1; - const usePluralFood = (!quantity) || quantity > 1 + const usePluralUnit = quantity !== undefined && (quantity * scale > 1 || quantity * scale === 0); + const usePluralFood = (!quantity) || quantity * scale > 1 let returnQty = "";