settings: change param to enable/disable depends by the depth
This commit is contained in:
parent
5d432cdcfc
commit
4ee70a8781
@ -51,11 +51,7 @@ func saveSettings(_ httprouter.Params, body []byte) (interface{}, error) {
|
||||
|
||||
func ApplySettings(config settings.FICSettings) {
|
||||
fic.PartialValidation = config.PartialValidation
|
||||
if config.EnableExerciceDepend {
|
||||
fic.UnlockedChallengeDepth = 0
|
||||
} else {
|
||||
fic.UnlockedChallengeDepth = -1
|
||||
}
|
||||
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
||||
fic.FirstBlood = config.FirstBlood
|
||||
fic.SubmissionCostBase = config.SubmissionCostBase
|
||||
fic.HintCoefficient = config.HintCurCoefficient
|
||||
|
@ -173,7 +173,7 @@ func main() {
|
||||
DenyNameChange: false,
|
||||
EnableResolutionRoute: false,
|
||||
PartialValidation: true,
|
||||
EnableExerciceDepend: true,
|
||||
UnlockedChallengeDepth:0,
|
||||
}); err != nil {
|
||||
log.Fatal("Unable to initialize settings.json:", err)
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -139,6 +139,7 @@
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" ng-model="config.enableExerciceDepend">
|
||||
<span class="custom-control-label">Activer les dépendances des exercices</span>
|
||||
<input type="text" class="form-control form-control-sm" id="duration" ng-model="config.unlockedChallengeDepth" ng-disabled="!config.enableExerciceDepend" integer>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
@ -52,13 +52,9 @@ func reloadSettings(config settings.FICSettings) {
|
||||
fic.WChoiceCoefficient = config.WChoiceCurCoefficient
|
||||
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
|
||||
ChStarted = time.Since(config.Start) >= 0
|
||||
if lastRegeneration != config.Generation || fic.PartialValidation != config.PartialValidation || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness {
|
||||
if lastRegeneration != config.Generation || fic.PartialValidation != config.PartialValidation || fic.UnlockedChallengeDepth != config.UnlockedChallengeDepth || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness {
|
||||
fic.PartialValidation = config.PartialValidation
|
||||
if config.EnableExerciceDepend {
|
||||
fic.UnlockedChallengeDepth = 0
|
||||
} else {
|
||||
fic.UnlockedChallengeDepth = -1
|
||||
}
|
||||
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
||||
|
||||
fic.FirstBlood = config.FirstBlood
|
||||
fic.SubmissionCostBase = config.SubmissionCostBase
|
||||
|
@ -57,8 +57,8 @@ type FICSettings struct {
|
||||
EnableResolutionRoute bool `json:"enableResolutionRoute"`
|
||||
// PartialValidation validates each correct given answers, don't expect Team to give all correct answer in a try.
|
||||
PartialValidation bool `json:"partialValidation"`
|
||||
// EnableExerciceDepend don't show (or permit to solve) to team challenges they are not unlocked through dependancies.
|
||||
EnableExerciceDepend bool `json:"enableExerciceDepend"`
|
||||
// UnlockedChallengeDepth don't show (or permit to solve) to team challenges they are not unlocked through dependancies.
|
||||
UnlockedChallengeDepth int `json:"unlockedChallengeDepth"`
|
||||
// SubmissionUniqueness don't count multiple times identical tries.
|
||||
SubmissionUniqueness bool `json:"submissionUniqueness"`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user