Browse Source

Fix bugs in analytics page

Lee Morgan 5 năm trước cách đây
mục cha
commit
eeb592b212
2 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 3 2
      views/dashboardPage/bundle.js
  2. 3 2
      views/dashboardPage/js/analytics.js

+ 3 - 2
views/dashboardPage/bundle.js

@@ -1317,7 +1317,7 @@ let analytics = {
 
         for(let i = 0; i < this.transactions.length; i++){
             if(currentDate.getDate() !== this.transactions[i].date.getDate()){
-                quantities.push(this.ingredient.ingredient.convert(currentQuantity));
+                quantities.push(currentQuantity);
                 dates.push(currentDate);
                 currentQuantity = 0;
                 currentDate = this.transactions[i].date;
@@ -1330,6 +1330,7 @@ let analytics = {
                             const transIngredient = this.transactions[i].recipes[j].recipe.ingredients[l];
 
                             if(transIngredient.ingredient === this.ingredient.ingredient){
+
                                 currentQuantity += transIngredient.quantity * this.transactions[i].recipes[j].quantity;
 
                                 break;
@@ -1340,7 +1341,7 @@ let analytics = {
             }
 
             if(i === this.transactions.length - 1){
-                quantities.push(this.ingredient.ingredient.convert(currentQuantity));
+                quantities.push(currentQuantity);
                 dates.push(currentDate);
             }
         }

+ 3 - 2
views/dashboardPage/js/analytics.js

@@ -119,7 +119,7 @@ let analytics = {
 
         for(let i = 0; i < this.transactions.length; i++){
             if(currentDate.getDate() !== this.transactions[i].date.getDate()){
-                quantities.push(this.ingredient.ingredient.convert(currentQuantity));
+                quantities.push(currentQuantity);
                 dates.push(currentDate);
                 currentQuantity = 0;
                 currentDate = this.transactions[i].date;
@@ -132,6 +132,7 @@ let analytics = {
                             const transIngredient = this.transactions[i].recipes[j].recipe.ingredients[l];
 
                             if(transIngredient.ingredient === this.ingredient.ingredient){
+
                                 currentQuantity += transIngredient.quantity * this.transactions[i].recipes[j].quantity;
 
                                 break;
@@ -142,7 +143,7 @@ let analytics = {
             }
 
             if(i === this.transactions.length - 1){
-                quantities.push(this.ingredient.ingredient.convert(currentQuantity));
+                quantities.push(currentQuantity);
                 dates.push(currentDate);
             }
         }