settings: Save duration in challenge.json

This commit is contained in:
nemunaire 2022-05-24 23:00:49 +02:00
commit 123467f3eb
3 changed files with 9 additions and 2 deletions

View file

@ -518,7 +518,11 @@ angular.module("FICApp")
$rootScope.settings.activateTime = new Date(response.activateTime);
})
$scope.challenge = SettingsChallenge.get();
$scope.duration = 360;
$scope.duration = 360;
$scope.challenge.$promise.then(function(c) {
if (c.duration)
$scope.duration = c.duration;
});
$scope.exerciceDependChange = function() {
if ($scope.config.enableExerciceDepend)
@ -528,6 +532,7 @@ angular.module("FICApp")
};
$scope.saveChallengeInfo = function() {
this.challenge.duration = $scope.duration;
this.challenge.$update(function(response) {
$scope.addToast('success', 'Infos du challenge mises à jour avec succès !');
}, function(response) {