var urllistapp = '/api/listapp';
var urllistcount = 'api/countuser/';
var meotrics = new Vue({
    el: '#tabelapp',
        data: {
            listApp: []
        },
        created: function(){
            this.getListApp();
        },
        updated: function(){
            this.addCountUsertoList(0);
        },
        methods:{
            getListApp: function(){
                _self = this;
                this.$http.get(urllistapp).then((response) => {
                    // success callback
                        for(var i in response.body){
                            response.body[i]["countuser"] = 0;
                        }
                        _self.listApp = response.body;
            }, (response) => {
        // error callback
            })
            },
            addCountUsertoList : function(i){
                _self = this;
                var appid = _self.listApp[i].code;
                _self.getCountUserinMonth(appid,function(countuser){
                    _self.listApp[i]["countuser"] = countuser;
                    i++;
                    if(i < _self.listApp.length){
                        _self.addCountUsertoList(i);
                    }
                })

            },
            getCountUserinMonth: function(appid,callback){
                var now = new Date();
                var today = parseInt(now.getTime()/1000);
                var month = now.getMonth();
                var year = now.getFullYear();
                var firstMonth = parseInt(new Date(year.toString(),month.toString(),1)/1000);
                console.log(firstMonth);
                var url = urllistcount+appid+"/"+firstMonth+"/"+today;
                this.$http.get(url).then((response) => {
                    // success callback
                        callback(response.body);
                    }, (response) => {
                        callback(0);
                    // error callback
                })
            },
        }
})
@@ -235,88 +235,8 @@
  %7D,%0A
-        updated: function()%7B%0A            this.addCountUsertoList(0);%0A        %7D,%0A
     
@@ -249,16 +249,16 @@
 thods:%7B%0A
+
         
@@ -616,16 +616,68 @@
 e.body;%0A
+                        this.addCountUsertoList(0);%0A
         
@@ -809,32 +809,36 @@
                 
+    
 _self = this;%0A  
@@ -827,32 +827,36 @@
   _self = this;%0A
+    
                 
@@ -902,24 +902,28 @@
             
+  
+  
 _self.getCou
@@ -975,32 +975,36 @@
                 
+    
 _self.listApp%5Bi%5D
@@ -1054,13 +1054,21 @@
     
+   
+ 
 i++;%0A
+    
     
@@ -1113,16 +1113,20 @@
 ength)%7B%0A
+    
         
@@ -1182,34 +1182,42 @@
                 
-%7D%0A
+    %7D%0A    
                 
@@ -1219,17 +1219,16 @@
      %7D)%0A
-%0A
         
@@ -1475,24 +1475,24 @@
 FullYear();%0A
+
             
@@ -1577,49 +1577,8 @@
 0);%0A
-                console.log(firstMonth);%0A
     

update amin