From 985b5634b75e0a7c85e85b3ff4ef755baa6d1460 Mon Sep 17 00:00:00 2001 From: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:12:45 +0100 Subject: [PATCH] fix: round ingredient amounts when not using fractions (#4470) --- frontend/composables/recipes/use-recipe-ingredients.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/composables/recipes/use-recipe-ingredients.ts b/frontend/composables/recipes/use-recipe-ingredients.ts index 9015e1fac..f22508e8e 100644 --- a/frontend/composables/recipes/use-recipe-ingredients.ts +++ b/frontend/composables/recipes/use-recipe-ingredients.ts @@ -54,7 +54,7 @@ export function useParsedIngredientText(ingredient: RecipeIngredient, disableAmo // casting to number is required as sometimes quantity is a string if (quantity && Number(quantity) !== 0) { if (unit && !unit.fraction) { - returnQty = (quantity * scale).toString(); + returnQty = Number((quantity * scale).toPrecision(3)).toString(); } else { const fraction = frac(quantity * scale, 10, true); if (fraction[0] !== undefined && fraction[0] > 0) {