Bläddra i källkod

Inventory Strand tested and working

Lee Morgan 6 år sedan
förälder
incheckning
61e811263f

+ 1 - 1
controllers/merchantData.js

@@ -432,7 +432,7 @@ module.exports = {
                 let updateIngredient = merchant.inventory.find(i => i.ingredient.toString() === req.body.ingredientId);
                 updateIngredient.quantity = (updateIngredient.quantity + req.body.quantityChange).toFixed(2);
                 merchant.save()
-                    .then((merchant)=>{
+                    .then((newMerchant)=>{
                         res.json(req.body.quantityChange);
                     })
                     .catch((err)=>{

+ 1 - 4
models/merchant.js

@@ -29,10 +29,7 @@ const MerchantSchema = new mongoose.Schema({
         default: Date.now
     },
     accountStatus: {
-        status: {
-            type: String,
-            required: true
-        },
+        status: String,
         expiration: Date,
     },
     inventory: [{

+ 0 - 1
views/inventoryPage/inventory.js

@@ -197,7 +197,6 @@ window.inventoryObj = {
                 })
                 .catch((err)=>{
                     banner.createError("There was an error and the ingredient has not been removed from your inventory");
-                    console.log(err);
                 });
         }else{
             banner.createError("You must remove this ingredient from all recipes before you can remove it from your inventory");

+ 2 - 2
views/inventoryPage/singleRecipe.js

@@ -3,7 +3,7 @@ window.singleRecipeObj = {
         clearScreen();
         document.querySelector("#singleRecipeAction").style.display = "flex";
 
-        let tbody = document.querySelector("tbody");
+        let tbody = document.querySelector("#singleRecipeAction tbody");
 
         while(tbody.children.length > 0){
             tbody.removeChild(tbody.firstChild);
@@ -43,7 +43,7 @@ window.singleRecipeObj = {
     },
 
     displayAdd: function(recipe){
-        let tbody = document.querySelector("tbody");
+        let tbody = document.querySelector("#singleRecipeAction tbody");
 
         let row = document.createElement("tr");
         tbody.appendChild(row);