settings: new parameter to don't respect flag dependancies

This commit is contained in:
nemunaire 2019-01-20 00:14:20 +01:00
parent 09b24cd401
commit 7d9ad18f42
5 changed files with 17 additions and 3 deletions

View File

@ -52,6 +52,7 @@ func saveSettings(_ httprouter.Params, body []byte) (interface{}, error) {
func ApplySettings(config settings.FICSettings) {
fic.PartialValidation = config.PartialValidation
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
fic.DisplayAllFlags = config.DisplayAllFlags
fic.FirstBlood = config.FirstBlood
fic.SubmissionCostBase = config.SubmissionCostBase
fic.HintCoefficient = config.HintCurCoefficient

View File

@ -143,6 +143,13 @@
</label>
</div>
<div class="form-check">
<label class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" ng-model="config.displayAllFlags">
<span class="custom-control-label">Désactiver les dépendances des flags</span>
</label>
</div>
<div class="form-check">
<label class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" ng-model="config.submissionUniqueness">

View File

@ -52,9 +52,10 @@ 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.UnlockedChallengeDepth != config.UnlockedChallengeDepth || 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.DisplayAllFlags != config.DisplayAllFlags || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness {
fic.PartialValidation = config.PartialValidation
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
fic.DisplayAllFlags = config.DisplayAllFlags
fic.FirstBlood = config.FirstBlood
fic.SubmissionCostBase = config.SubmissionCostBase

View File

@ -9,6 +9,9 @@ import (
"strings"
)
// DisplayAllFlags doesn't respect the predefined constraint existing between flags.
var DisplayAllFlags bool
type myTeamFile struct {
Path string `json:"path"`
Name string `json:"name"`
@ -179,7 +182,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
for _, k := range flags {
var flag myTeamFlag
if t != nil && !t.CanSeeFlag(k) {
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(k) {
// Dependancy missing, skip the flag for now
continue
}
@ -237,7 +240,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
return nil, err
} else {
for _, mcq := range mcqs {
if t != nil && !t.CanSeeFlag(mcq) {
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(mcq) {
// Dependancy missing, skip the flag for now
continue
}

View File

@ -61,6 +61,8 @@ type FICSettings struct {
UnlockedChallengeDepth int `json:"unlockedChallengeDepth"`
// SubmissionUniqueness don't count multiple times identical tries.
SubmissionUniqueness bool `json:"submissionUniqueness"`
// DisplayAllFlags doesn't respect the predefined constraint existing between flags.
DisplayAllFlags bool `json:"displayAllFlags"`
// EventKindness will ask browsers to delay notification interval.
EventKindness bool `json:"eventKindness"`
}