Explorar el Código

Bug fix: Editing ingredient quantity and unit gave incorrect amount.

Lee Morgan hace 5 años
padre
commit
a2d139b45f
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      views/dashboardPage/js/sidebars/editIngredient.js

+ 3 - 2
views/dashboardPage/js/sidebars/editIngredient.js

@@ -74,8 +74,7 @@ let editIngredient = {
             name: document.getElementById("editIngName").value,
             category: document.getElementById("editIngCategory").value,
             ingredients: [],
-            quantity: controller.baseUnit(quantity, ingredient.ingredient.unit)
-        }
+        };
 
         //Get the measurement unit
         let units = document.getElementById("unitButtons");
@@ -86,6 +85,8 @@ let editIngredient = {
             }
         }
 
+        data.quantity = controller.baseUnit(quantity, data.unit);
+
         let loader = document.getElementById("loaderContainer");
         loader.style.display = "flex";