frontend: fix race condition in interface

This commit is contained in:
nemunaire 2018-11-21 05:36:52 +01:00 committed by Pierre-Olivier Mercier
parent 129baaacee
commit bd0416eede

View file

@ -182,10 +182,16 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$rootScope.refresh();
})
.controller("ExerciceController", function($scope, $routeParams, $http, $rootScope, $timeout) {
$rootScope.current_theme = $scope.themesUrl[$routeParams.theme];
$scope.$watch("themesUrl", function(themesUrl) {
if (themesUrl != undefined)
$rootScope.current_theme = themesUrl[$routeParams.theme];
})
if ($routeParams.exercice) {
$rootScope.current_exercice = $scope.exercicesUrl[$routeParams.exercice];
$scope.$watch("exercicesUrl", function(exercicesUrl) {
if (exercicesUrl != undefined)
$rootScope.current_exercice = exercicesUrl[$routeParams.exercice];
})
} else {
if ($scope.themes && $scope.my && $scope.themes[$scope.current_theme]) {
var exos = Object.keys($scope.themes[$scope.current_theme].exercices);