From 6bd23ee9f05fe050dce48665718d62dcd4c5828c Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Tue, 4 Apr 2023 01:49:38 +0200 Subject: [PATCH] admin: Fix move between exercices --- admin/static/js/app.js | 16 +++++++--------- admin/static/views/exercice-flags.html | 6 +++--- admin/static/views/exercice-resolution.html | 6 +++--- admin/static/views/exercice.html | 6 +++--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/admin/static/js/app.js b/admin/static/js/app.js index c26f7472..53b2eb72 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -1696,20 +1696,18 @@ angular.module("FICApp") } else { $scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId }); } + + $scope.my_ex_num = {}; + $http({ url: "api/themes.json", method: "GET" }).then(function(response) { $scope.themes = response.data - var last_exercice = null; - angular.forEach($scope.themes[$scope.exercice.id_theme].exercices, function(exercice, k) { - if (last_exercice != null) { - $scope.themes[$scope.exercice.id_theme].exercices[last_exercice].next = k; - exercice.previous = last_exercice; - } - last_exercice = k; - exercice.id = k; - }); + for (var k in $scope.themes[$scope.exercice.id_theme].exercices) { + var exercice = $scope.themes[$scope.exercice.id_theme].exercices[k]; + $scope.my_ex_num[exercice.id] = k; + } }); $scope.exercices = Exercice.query(); $scope.fields = ["title", "urlid", "disabled", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "resolution", "issue", "issuekind", "wip"]; diff --git a/admin/static/views/exercice-flags.html b/admin/static/views/exercice-flags.html index 411d98d4..af95c170 100644 --- a/admin/static/views/exercice-flags.html +++ b/admin/static/views/exercice-flags.html @@ -2,9 +2,9 @@

{{exercice.title}} Flags -
- - +
+ +

diff --git a/admin/static/views/exercice-resolution.html b/admin/static/views/exercice-resolution.html index a661d7e4..88d00e92 100644 --- a/admin/static/views/exercice-resolution.html +++ b/admin/static/views/exercice-resolution.html @@ -1,8 +1,8 @@

{{exercice.title}} Résolution -
- - +
+ +

diff --git a/admin/static/views/exercice.html b/admin/static/views/exercice.html index 0c745afd..43839738 100644 --- a/admin/static/views/exercice.html +++ b/admin/static/views/exercice.html @@ -3,9 +3,9 @@ {{exercice.title}} {{themes[exercice.id_theme].name}} -
- - +
+ +