frontend: really implement next challenge button

This commit is contained in:
nemunaire 2018-11-27 19:59:47 +01:00
parent 17ef0b0a32
commit bb33572b19
2 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,12 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
var tags = {};
angular.forEach($scope.themes, function(theme, key) {
$scope.themes[key].exercice_solved = 0;
var last_exercice = null;
angular.forEach(theme.exercices, function(exercice, k) {
if (last_exercice != null)
last_exercice.next = k;
last_exercice = exercice;
if ($scope.my.exercices && $scope.my.exercices[k] && $scope.my.exercices[k].solved) {
$scope.themes[key].exercice_solved++;
}

View File

@ -108,7 +108,7 @@
<p class="card-text">
Vous êtes la {{ my.exercices[current_exercice].solved_rank }}<sup><ng-pluralize count="my.exercices[current_exercice].solved_rank" when="{'one': 're', 'other': 'e'}"></ng-pluralize></sup> équipe à avoir résolu ce challenge à {{ my.exercices[current_exercice].solved_time | date:"mediumTime" }}. Vous avez marqué <ng-pluralize count="my.exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> !
</p>
<a href="/{{ themes[current_theme].urlid }}" class="btn btn-success">Passer au challenge suivant</a>
<a href="/{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[themes[current_theme].exercices[current_exercice].next].urlid }}" class="btn btn-success" ng-if="themes[current_theme].exercices[current_exercice].next">Passer au challenge suivant</a>
</div>
</div>