Browse Source

Fix bug with new transactions not being properly added in frontend.

Lee Morgan 5 years ago
parent
commit
e05341f590
2 changed files with 2 additions and 2 deletions
  1. 1 1
      views/dashboardPage/bundle.js
  2. 1 1
      views/dashboardPage/js/Merchant.js

+ 1 - 1
views/dashboardPage/bundle.js

@@ -437,7 +437,7 @@ class Merchant{
         for(let i = 0; i < transaction.recipes.length; i++){
             const recipe = transaction.recipes[i];
             for(let j = 0; j < recipe.recipe.ingredients.length; j++){
-                const ingredient = recipe.recipe.ingredients[i];
+                const ingredient = recipe.recipe.ingredients[j];
                 if(ingredients[ingredient.ingredient.id]){
                     ingredients[ingredient.ingredient.id] += recipe.quantity * ingredient.quantity;
                 }else{

+ 1 - 1
views/dashboardPage/js/Merchant.js

@@ -310,7 +310,7 @@ class Merchant{
         for(let i = 0; i < transaction.recipes.length; i++){
             const recipe = transaction.recipes[i];
             for(let j = 0; j < recipe.recipe.ingredients.length; j++){
-                const ingredient = recipe.recipe.ingredients[i];
+                const ingredient = recipe.recipe.ingredients[j];
                 if(ingredients[ingredient.ingredient.id]){
                     ingredients[ingredient.ingredient.id] += recipe.quantity * ingredient.quantity;
                 }else{