Преглед на файлове

Bug fix: updating sub-ingredients was not creating a subIngredient class instance on frontend.

Lee Morgan преди 4 години
родител
ревизия
a4d6081d4e
променени са 1 файла, в които са добавени 7 реда и са изтрити 4 реда
  1. 7 4
      views/dashboardPage/js/classes/Ingredient.js

+ 7 - 4
views/dashboardPage/js/classes/Ingredient.js

@@ -79,10 +79,13 @@ class Ingredient{
 
     addIngredients(ingredients){
         for(let i = 0; i < ingredients.length; i++){
-            this._subIngredients.push({
-                ingredient: this._parent.getIngredient(ingredients[i].ingredient).ingredient,
-                quantity: ingredients[i].quantity
-            });
+            this._subIngredients.push(new SubIngredient(
+                ingredients[i].id,
+                ingredients[i].ingredient,
+                ingredients[i].quantity,
+                ingredients[i].unit,
+                this
+            ));
         }
     }