settings: Save duration in challenge.json

This commit is contained in:
nemunaire 2022-05-24 23:00:49 +02:00
parent 58217d1d8a
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) {

View File

@ -169,7 +169,7 @@
<label class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" ng-model="config.enableExerciceDepend" ng-change="exerciceDependChange()">
<span class="custom-control-label">Activer les dépendances des exercices</span>
<input type="number" class="form-control form-control-sm" id="duration" ng-model="config.unlockedChallengeDepth" ng-disabled="!config.enableExerciceDepend" title="-1 : Désactivé ; 0: activé ; 1,2,3 : débloque 1,2,3,... exercices supplémentaires après un challenge validé" min="0" integer>
<input type="number" class="form-control form-control-sm" ng-model="config.unlockedChallengeDepth" ng-disabled="!config.enableExerciceDepend" title="-1 : Désactivé ; 0: activé ; 1,2,3 : débloque 1,2,3,... exercices supplémentaires après un challenge validé" min="0" integer>
</label>
</div>

View File

@ -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"`