Add progress stats

This commit is contained in:
nemunaire 2016-01-24 15:22:53 +01:00
parent 6863891ba2
commit 257a9977ea
2 changed files with 33 additions and 22 deletions

View file

@ -54,6 +54,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$rootScope.time.end = false;
$rootScope.time.expired = false;
}
$rootScope.time.duration = time.du;
$rootScope.time.remaining = remain;
$rootScope.time.hours = Math.floor(remain / 3600);
$rootScope.time.minutes = Math.floor((remain % 3600) / 60);
@ -116,8 +117,14 @@ angular.module("FICApp")
});
$http.get("/themes.json").success(function(themes) {
$scope.themes = themes;
$scope.max_gain = 0;
angular.forEach(themes, function(theme, key) {
this[key].exercice_count = Object.keys(theme.exercices).length;
this[key].gain = 0;
angular.forEach(theme.exercices, function(ex, k) {
this.gain += ex.gain;
}, theme);
$scope.max_gain += theme.gain;
}, themes);
actMenu();
});