dashboard: Fix last challenge due to hashtable change

This commit is contained in:
nemunaire 2023-04-05 17:10:53 +02:00
commit 0d596ccb8c
2 changed files with 17 additions and 12 deletions

View file

@ -26,11 +26,13 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
var res = event.txt.match(/<strong>(\d+)<sup>e<\/sup><\/strong> défi ([^&]+)/);
if (res) {
for (var tid in $scope.themes) {
if ($scope.themes[tid].name == res[2]) {
lastExercice = Object.keys($scope.themes[tid].exercices)[parseInt(res[1])-1];
if ($scope.themes[tid].name == res[2]) {
for (var eid in $scope.themes[tid].exercices) {
lastExercice = $scope.themes[tid].exercices[parseInt(res[1])-1].id;
break;
}
}
}
}
}
}
event.time = Date.parse(event.time);
@ -132,7 +134,8 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
return;
$scope.lastthemeetag = response.headers()["last-modified"];
var themes = response.data;
var themes = response.data;
var exercices = {};
$scope.themes = themes;
$scope.max_gain = 0;
angular.forEach(themes, function(theme, key) {
@ -142,10 +145,12 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
this[key].exercice_count = 0;
this[key].gain = 0;
angular.forEach(theme.exercices, function(ex, k) {
exercices[ex.id] = ex;
this.gain += ex.gain;
}, theme);
$scope.max_gain += theme.gain;
}, themes);
$scope.exercices = exercices;
});
$http.get("./teams.json").then(function(response) {
if ($scope.lastteametag != undefined && $scope.lastteametag == response.headers()["last-modified"])