Coefficients transit and display on UI

This commit is contained in:
nemunaire 2017-01-16 13:09:31 +01:00
parent 78ce24f3f7
commit b42016c74a
7 changed files with 64 additions and 20 deletions

View file

@ -89,16 +89,25 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
time.he = (new Date()).getTime();
sessionStorage.userService = angular.toJson(time);
});
$http.get("/settings.json").success(function(settings) {
$scope.settings = settings;
});
$http.get("/themes.json").success(function(themes) {
$scope.themes = themes;
$scope.max_gain = 0;
$scope.max_solved = 0;
angular.forEach(themes, function(theme, key) {
this[key].exercice_count = Object.keys(theme.exercices).length;
this[key].exercice_coeff_max = 0;
this[key].gain = 0;
this[key].solved = 0;
angular.forEach(theme.exercices, function(ex, k) {
this.gain += ex.gain;
this.solved += ex.solved;
this.exercice_coeff_max = Math.max(this.exercice_coeff_max, ex.curcoeff);
}, theme);
$scope.max_gain += theme.gain;
$scope.max_solved = Math.max($scope.max_solved, theme.solved);
}, themes);
actMenu();
});
@ -116,6 +125,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$http.get("/my.json").success(function(my) {
$scope.my = my;
angular.forEach($scope.my.exercices, function(exercice, eid) {
exercice.solved = exercice.solved_rank > 0;
if (exercice.video_uri) {
exercice.video_uri = $sce.trustAsResourceUrl(exercice.video_uri);
}