settings: change param to enable/disable depends by the depth

This commit is contained in:
nemunaire 2019-01-18 20:30:47 +01:00
parent 5d432cdcfc
commit 4ee70a8781
6 changed files with 12 additions and 15 deletions

View file

@ -425,6 +425,7 @@ angular.module("FICApp")
.controller("SettingsController", function($scope, $rootScope, Settings, ROSettings, $location, $http, $interval) {
$scope.config = Settings.get();
$scope.config.$promise.then(function(response) {
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
$rootScope.settings.start = new Date(response.start);
$rootScope.settings.end = new Date(response.end);
$rootScope.settings.generation = new Date(response.generation);
@ -454,8 +455,11 @@ angular.module("FICApp")
var nEnd = this.config.end;
var nGen = this.config.generation;
var aTime = this.config.activateTime;
this.config.$update(function() {
var state = this.config.enableExerciceDepend;
this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1)
this.config.$update(function(response) {
$rootScope.newBox('success', msg);
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
$rootScope.settings.start = new Date(nStart);
$rootScope.settings.end = new Date(nEnd);
$rootScope.settings.generation = new Date(nGen);