frontend: add a menu items regrouping tags

This commit is contained in:
nemunaire 2018-11-25 05:01:26 +01:00
parent c43bafa21b
commit d0bd722c92
2 changed files with 18 additions and 0 deletions

View file

@ -102,14 +102,24 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
.controller("DataController", function($sce, $scope, $http, $rootScope, $timeout, $location) {
var actMenu = function() {
if ($scope.my && $scope.themes) {
var tags = {};
angular.forEach($scope.themes, function(theme, key) {
$scope.themes[key].exercice_solved = 0;
angular.forEach(theme.exercices, function(exercice, k) {
if ($scope.my.exercices && $scope.my.exercices[k] && $scope.my.exercices[k].solved) {
$scope.themes[key].exercice_solved++;
}
angular.forEach(exercice.tags, function(tag) {
if (!tags[tag])
tags[tag] = {count: 1, solved: 0};
else
tags[tag].count += 1;
if ($scope.my.exercices && $scope.my.exercices[k] && $scope.my.exercices[k].solved)
tags[tag].solved += 1;
});
});
});
$scope.tags = tags;
}
}
$rootScope.refresh = function(justMy) {