소스 검색

Fix adding of ingredients. Everything working now.

Lee Morgan 5 년 전
부모
커밋
f74f2fbf23
3개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      controllers/ingredientData.js
  2. 4 2
      views/dashboardPage/bundle.js
  3. 4 2
      views/dashboardPage/js/newIngredient.js

+ 1 - 1
controllers/ingredientData.js

@@ -80,7 +80,7 @@ module.exports = {
                 }
 
                 if(response[0].specialUnit === "bottle"){
-                    newIngredient.quantity = req.body.quantity;
+                    newIngredient.quantity = req.body.quantity * response[0].unitSize;
                 }else{
                     newIngredient.quantity = Helper.convertQuantityToBaseUnit(req.body.quantity, req.body.defaultUnit);
                 }

+ 4 - 2
views/dashboardPage/bundle.js

@@ -2639,7 +2639,7 @@ let newIngredient = {
         //Change the ingredient if it is a special unit type (ie "bottle")
         if(unit === "bottle"){
             newIngredient.ingredient.unitType = "volume";
-            newIngredient.ingredient.unitSize = document.getElementById("bottleSize").value
+            newIngredient.ingredient.unitSize = document.getElementById("bottleSize").value;
             newIngredient.defaultUnit = document.getElementById("bottleUnits").value;
             newIngredient.ingredient.specialUnit = unit;
             newIngredient.quantity = quantityValue;
@@ -2684,7 +2684,9 @@ let newIngredient = {
             .finally(()=>{
                 loader.style.display = "none";
             });
-    }
+    },
+
+
 }
 
 module.exports = newIngredient;

+ 4 - 2
views/dashboardPage/js/newIngredient.js

@@ -44,7 +44,7 @@ let newIngredient = {
         //Change the ingredient if it is a special unit type (ie "bottle")
         if(unit === "bottle"){
             newIngredient.ingredient.unitType = "volume";
-            newIngredient.ingredient.unitSize = document.getElementById("bottleSize").value
+            newIngredient.ingredient.unitSize = document.getElementById("bottleSize").value;
             newIngredient.defaultUnit = document.getElementById("bottleUnits").value;
             newIngredient.ingredient.specialUnit = unit;
             newIngredient.quantity = quantityValue;
@@ -89,7 +89,9 @@ let newIngredient = {
             .finally(()=>{
                 loader.style.display = "none";
             });
-    }
+    },
+
+
 }
 
 module.exports = newIngredient;