ソースを参照

Fix everything so that clover works

Lee Morgan 6 年 前
コミット
cf4e71d476
3 ファイル変更12 行追加4 行削除
  1. 0 1
      controllers/merchantData.js
  2. 4 2
      controllers/renderer.js
  3. 8 1
      views/dashboardPage/home.js

+ 0 - 1
controllers/merchantData.js

@@ -328,7 +328,6 @@ module.exports = {
                             break;
                         }
                     }
-                    console.log(updateIngredient);
 
                     adjustments.push(new InventoryAdjustment({
                         date: Date.now(),

+ 4 - 2
controllers/renderer.js

@@ -122,14 +122,16 @@ module.exports = {
                                     let errorMessage = "Error: unable to update data";
                                     
                                     merchant.password = undefined;
-                                    return res.render("dashboardPage/dashboard", {merchant: merchant, error: errorMessage});
+                                    return res.render("dashboardPage/dashboard", {merchant: merchant, error: errorMessage, transactions: []});
                                 });
                         })
                         .catch((err)=>{
+                            console.log("Fucking bitch error");
+                            console.log(err);
                             let errorMessage = "There was an error and we could not retrieve your transactions from Clover";
 
                             merchant.password = undefined;
-                            return res.render("dashboardPage/dashboard", {merchant: merchant, error: errorMessage});
+                            return res.render("dashboardPage/dashboard", {merchant: merchant, error: errorMessage, transactions: []});
                         });
                 }else if(merchant.pos === "none"){
                     merchant.password = undefined;

+ 8 - 1
views/dashboardPage/home.js

@@ -4,6 +4,7 @@ window.homeStrandObj = {
 
     display: function(){
         if(!this.isPopulated){
+
             this.drawRevenueCard();
             this.drawRevenueGraph();
             this.drawInventoryCheckCard();
@@ -67,8 +68,14 @@ window.homeStrandObj = {
     },
 
     drawInventoryCheckCard: function(){
+        let num;
+        if(merchant.inventory.length < 5){
+            num = merchant.inventory.length;
+        }else{
+            num = 5;
+        }
         let rands = [];
-            for(let i = 0; i < 5; i++){
+            for(let i = 0; i < num; i++){
                 let rand = Math.floor(Math.random() * merchant.inventory.length);
 
                 if(rands.includes(rand)){