Forráskód Böngészése

Change "home" to "dashboard". Fix error for loading of popular card when not enough transactions.

Lee Morgan 5 éve
szülő
commit
1486514274

+ 2 - 1
views/dashboardPage/bundle.js

@@ -1341,7 +1341,8 @@ let home = {
             let quantities = [];
             let labels = [];
             let colors = [];
-            for(let i = 4; i >= 0; i--){
+            let count = (ingredientList.length < 5) ? ingredientList.length - 1 : 4;
+            for(let i = count; i >= 0; i--){
                 const ingredientName = ingredientList[i].ingredient.name;
                 const ingredientQuantity = ingredientList[i].ingredient.convert(ingredientList[i].quantity);
                 const unitName = ingredientList[i].ingredient.unit;

+ 1 - 1
views/dashboardPage/dashboard.ejs

@@ -35,7 +35,7 @@
                     <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
                     <polyline points="9 22 9 12 15 12 15 22"></polyline>
                 </svg>
-                <p>HOME</p>
+                <p>DASHBOARD</p>
             </button>
         
             <button class="menuButton" id="ingredientsBtn" onclick="controller.openStrand('ingredients')">

+ 2 - 1
views/dashboardPage/js/home.js

@@ -150,7 +150,8 @@ let home = {
             let quantities = [];
             let labels = [];
             let colors = [];
-            for(let i = 4; i >= 0; i--){
+            let count = (ingredientList.length < 5) ? ingredientList.length - 1 : 4;
+            for(let i = count; i >= 0; i--){
                 const ingredientName = ingredientList[i].ingredient.name;
                 const ingredientQuantity = ingredientList[i].ingredient.convert(ingredientList[i].quantity);
                 const unitName = ingredientList[i].ingredient.unit;