diff --git a/admin/static/js/app.js b/admin/static/js/app.js index 295a25d8..87bb4c6c 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -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) { diff --git a/admin/static/views/settings.html b/admin/static/views/settings.html index 7512d4b3..5c6bdfe3 100644 --- a/admin/static/views/settings.html +++ b/admin/static/views/settings.html @@ -169,7 +169,7 @@ diff --git a/settings/challenge.go b/settings/challenge.go index a6b38dee..ed6c2af1 100644 --- a/settings/challenge.go +++ b/settings/challenge.go @@ -17,6 +17,8 @@ type ChallengeInfo struct { SubTitle string `json:"subtitle"` // Authors is the group name of people making the challenge. Authors string `json:"authors"` + // ExpectedDuration is the duration (in minutes) suggested when stating the challenge. + ExpectedDuration uint `json:"duration"` // VideoLink is the link to explaination videos when the challenge is over. VideosLink string `json:"videoslink"`