1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-03 04:25:24 +02:00

fix: round ingredient amounts when not using fractions (#4470)

This commit is contained in:
Kuchenpirat 2024-10-30 16:12:45 +01:00 committed by GitHub
parent 2b2bc041bd
commit 985b5634b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) {