Преглед изворни кода

Fix error being displayed when logging in with no ingredients

Lee Morgan пре 6 година
родитељ
комит
47a10c606d
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      views/dashboardPage/home.js

+ 3 - 3
views/dashboardPage/home.js

@@ -110,9 +110,9 @@ window.homeStrandObj = {
         let thisMonth = new Date(now.getFullYear(), now.getMonth(), 1);
 
         let ingredientList = merchant.ingredientsSold(merchant.transactionIndices(thisMonth));
-        window.ingredientList = [...ingredientList];
-        let iterations = (ingredientList.length < 5) ? ingredientList.length : 5;
-        if(ingredientList.length > 0){
+        if(ingredientList !== false){
+            window.ingredientList = [...ingredientList];
+            let iterations = (ingredientList.length < 5) ? ingredientList.length : 5;
             for(let i = 0; i < iterations; i++){
                 try{
                     let max = ingredientList[0].quantity;