Procházet zdrojové kódy

Bug Fix: Analytics strand was not displaying anything correctly because it was going through the response array in the wrong order.
I simply reverse the array when it comes down.

Lee Morgan před 5 roky
rodič
revize
c2a3c538ae

+ 0 - 3
controllers/transactionData.js

@@ -21,7 +21,6 @@ module.exports = {
             req.session.error = "MUST BE LOGGED IN TO DO THAT";
             return res.redirect("/");
         }
-        console.log(req.body);
 
         let from = new Date(req.body.from);
         let to = new Date(req.body.to);
@@ -44,8 +43,6 @@ module.exports = {
             }
         }
 
-        console.log(query);
-
         Transaction.aggregate([
             {$match: {
                 merchant: ObjectId(req.session.user),

+ 1 - 6
views/dashboardPage/bundle.js

@@ -3056,8 +3056,6 @@ let analytics = {
     },
 
     getData: function(from, to, Transaction){
-        console.log(from);
-        console.log(to);
         let data = {
             from: from,
             to: to,
@@ -3079,8 +3077,8 @@ let analytics = {
                 if(typeof(response) === "string"){
                     controller.createBanner(response, "error");
                 }else{
-                    console.log(response);
                     this.transactionsByDate = [];
+                    response.reverse();
 
                     let startOfDay = new Date(from.getTime());
                     startOfDay.setHours(0, 0, 0, 0);
@@ -3112,12 +3110,9 @@ let analytics = {
                         startOfDay.setDate(startOfDay.getDate() + 1);
                         endOfDay.setDate(endOfDay.getDate() + 1);
                     }
-
-                    console.log(this.transactionsByDate);
                 }
             })
             .catch((err)=>{
-                console.log(err);
                 controller.createBanner("UNABLE TO UPDATE THE PAGE", "error");
             })
             .finally(()=>{

+ 1 - 6
views/dashboardPage/js/strands/analytics.js

@@ -69,8 +69,6 @@ let analytics = {
     },
 
     getData: function(from, to, Transaction){
-        console.log(from);
-        console.log(to);
         let data = {
             from: from,
             to: to,
@@ -92,8 +90,8 @@ let analytics = {
                 if(typeof(response) === "string"){
                     controller.createBanner(response, "error");
                 }else{
-                    console.log(response);
                     this.transactionsByDate = [];
+                    response.reverse();
 
                     let startOfDay = new Date(from.getTime());
                     startOfDay.setHours(0, 0, 0, 0);
@@ -125,12 +123,9 @@ let analytics = {
                         startOfDay.setDate(startOfDay.getDate() + 1);
                         endOfDay.setDate(endOfDay.getDate() + 1);
                     }
-
-                    console.log(this.transactionsByDate);
                 }
             })
             .catch((err)=>{
-                console.log(err);
                 controller.createBanner("UNABLE TO UPDATE THE PAGE", "error");
             })
             .finally(()=>{