From f4865f21fbb328c20bbcbf4c6e3b56e158d2fc52 Mon Sep 17 00:00:00 2001 From: Ryan Noelk Date: Thu, 28 May 2020 00:46:38 +0200 Subject: [PATCH] Add the quantity for each ingredient so the preview will display properly (#48) --- modules/recipe_form/components/IngredientBox.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/recipe_form/components/IngredientBox.js b/modules/recipe_form/components/IngredientBox.js index 310cff21..62381982 100644 --- a/modules/recipe_form/components/IngredientBox.js +++ b/modules/recipe_form/components/IngredientBox.js @@ -121,7 +121,15 @@ class IngredientBox extends React.Component { />
- + { + // Add the quantity for each ingredient so the preview will display properly + const ings = [...x.ingredients].map(i => {return { + quantity: i.numerator ? formatQuantity(1, 1, i.numerator, i.denominator) + " " : '', + ...i + }}) + + return { ...x, ingredients: ings } + })}/>