瀏覽代碼

Fix bad hacks created earlier.
Removed the multiplying and dividing of units on the back end in order to compensate for frontend bugs.

Lee Morgan 5 年之前
父節點
當前提交
a73c4386b5
共有 3 個文件被更改,包括 2 次插入4 次删除
  1. 2 2
      controllers/orderData.js
  2. 0 1
      views/dashboardPage/bundle.js
  3. 0 1
      views/dashboardPage/js/sidebars/orderDetails.js

+ 2 - 2
controllers/orderData.js

@@ -233,11 +233,11 @@ module.exports = {
                         if(merchant.inventory[j].ingredient.name.toLowerCase() === array[i][locations.ingredients].toLowerCase()){
                             let baseQuantity = 0;
                             if(merchant.inventory[j].ingredient.specialUnit === "bottle"){
-                                baseQuantity = array[i][locations.quantity] * merchant.inventory[j].ingredient.unitSize * 1000;
+                                baseQuantity = array[i][locations.quantity] * merchant.inventory[j].ingredient.unitSize;
                                 currentOrder.ingredients.push({
                                     ingredient: merchant.inventory[j].ingredient._id,
                                     quantity: baseQuantity,
-                                    pricePerUnit: (array[i][locations.price] * 100) / merchant.inventory[j].ingredient.unitSize / 1000
+                                    pricePerUnit: (array[i][locations.price] * 100) / merchant.inventory[j].ingredient.unitSize
                                 });
                             }else{
                                 baseQuantity = helper.convertQuantityToBaseUnit(array[i][locations.quantity], merchant.inventory[j].defaultUnit);

+ 0 - 1
views/dashboardPage/bundle.js

@@ -2720,7 +2720,6 @@ let orderDetails = {
             
             let ingredientDisplay = ingredientDiv.children[1];
             if(ingredient.specialUnit === "bottle"){
-                console.log(order.ingredients[i].pricePerUnit);
                 ingredientDisplay.innerText = `${order.ingredients[i].quantity.toFixed(2)} bottles x $${order.ingredients[i].pricePerUnit.toFixed(2)}`;
             }else{
                 ingredientDisplay.innerText = `${order.ingredients[i].quantity.toFixed(2)} ${ingredient.unit.toUpperCase()} X $${order.ingredients[i].pricePerUnit.toFixed(2)}`;

+ 0 - 1
views/dashboardPage/js/sidebars/orderDetails.js

@@ -26,7 +26,6 @@ let orderDetails = {
             
             let ingredientDisplay = ingredientDiv.children[1];
             if(ingredient.specialUnit === "bottle"){
-                console.log(order.ingredients[i].pricePerUnit);
                 ingredientDisplay.innerText = `${order.ingredients[i].quantity.toFixed(2)} bottles x $${order.ingredients[i].pricePerUnit.toFixed(2)}`;
             }else{
                 ingredientDisplay.innerText = `${order.ingredients[i].quantity.toFixed(2)} ${ingredient.unit.toUpperCase()} X $${order.ingredients[i].pricePerUnit.toFixed(2)}`;