From ff60378d00fb220a0bb072beaca1cb99a853b2f5 Mon Sep 17 00:00:00 2001 From: mfreund Date: Sat, 6 Jul 2024 17:33:56 +0200 Subject: [PATCH] Include 'usage info' when importing chefkoch recipes --- functions/src/chefkoch.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/src/chefkoch.ts b/functions/src/chefkoch.ts index 4166a43..19a9907 100644 --- a/functions/src/chefkoch.ts +++ b/functions/src/chefkoch.ts @@ -34,7 +34,7 @@ const internalFetchRecipe = async (recipeId: string, chefkochCookie?: string) => const convertToPartialRecipe = (chefkochRecipe: any): RecipeDraft => { const recipe: any = {}; - + if (!chefkochRecipe.title) { throw new Error('Unable to parse recipe name from chefkoch recipe!'); } @@ -46,14 +46,14 @@ const convertToPartialRecipe = (chefkochRecipe: any): RecipeDraft => { recipe.cookTime = chefkochRecipe.cookingTime; recipe.totalTime = chefkochRecipe.totalTime; recipe.recipeYield = chefkochRecipe.servings; - + const ingredients: Ingredient[] = [] - + for (const ingredientGroup of chefkochRecipe.ingredientGroups || []) { for (const chefkochIngredient of ingredientGroup.ingredients) { let ingredientString; try { - ingredientString = [chefkochIngredient.amount || '', chefkochIngredient.unit || '', chefkochIngredient.name].join(' '); + ingredientString = [chefkochIngredient.amount || '', chefkochIngredient.unit || '', chefkochIngredient.name].join(' ') + (chefkochIngredient.usageInfo || ''); const ingredient = parseIngredient(ingredientString); ingredients.push(...ingredient); } catch (err) {