/*made by Miguel Rodrigues @ KBZ miguel.rodrigues@knowledgebiz.pt*/
console.log("Defining statisticsCtrl");
angular.module('mainApp')
.controller('statisticsCtrl', function($scope, $routeParams, $http, appService) {
$scope.appID = $routeParams.appid;
console.log("Running statisticsCtrl for developerid (" + $routeParams.developerid + ")");
appService.getRuleStatistics($routeParams.rulesid).then(function(response){
if(response.data.success){
console.log("getRuleStatistics response: " + JSON.stringify(response.data));
$scope.statistics = response.data.data;
var json = JSON.stringify(response.data);
$scope.totalNotifications = response.data.total.totalNotifications;
$scope.totalNotificationsApplyByRules = response.data.total.totalNotificationsApplyByRules;
$scope.averageValue = response.data.total.averageValue;
$scope.percentage = response.data.total.percentage;
}else{
//call notification service
console.log("Something went wrong...");
}
}).then(function(){
console.log("getRuleStatistics timed out");
});
console.log("Loading statisticsCtrl");
});