settings: new parameter to don't respect flag dependancies
This commit is contained in:
parent
09b24cd401
commit
7d9ad18f42
@ -52,6 +52,7 @@ func saveSettings(_ httprouter.Params, body []byte) (interface{}, error) {
|
|||||||
func ApplySettings(config settings.FICSettings) {
|
func ApplySettings(config settings.FICSettings) {
|
||||||
fic.PartialValidation = config.PartialValidation
|
fic.PartialValidation = config.PartialValidation
|
||||||
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
||||||
|
fic.DisplayAllFlags = config.DisplayAllFlags
|
||||||
fic.FirstBlood = config.FirstBlood
|
fic.FirstBlood = config.FirstBlood
|
||||||
fic.SubmissionCostBase = config.SubmissionCostBase
|
fic.SubmissionCostBase = config.SubmissionCostBase
|
||||||
fic.HintCoefficient = config.HintCurCoefficient
|
fic.HintCoefficient = config.HintCurCoefficient
|
||||||
|
@ -143,6 +143,13 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</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">
|
<div class="form-check">
|
||||||
<label class="custom-control custom-checkbox">
|
<label class="custom-control custom-checkbox">
|
||||||
<input class="custom-control-input" type="checkbox" ng-model="config.submissionUniqueness">
|
<input class="custom-control-input" type="checkbox" ng-model="config.submissionUniqueness">
|
||||||
|
@ -52,9 +52,10 @@ func reloadSettings(config settings.FICSettings) {
|
|||||||
fic.WChoiceCoefficient = config.WChoiceCurCoefficient
|
fic.WChoiceCoefficient = config.WChoiceCurCoefficient
|
||||||
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
|
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
|
||||||
ChStarted = time.Since(config.Start) >= 0
|
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.PartialValidation = config.PartialValidation
|
||||||
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
||||||
|
fic.DisplayAllFlags = config.DisplayAllFlags
|
||||||
|
|
||||||
fic.FirstBlood = config.FirstBlood
|
fic.FirstBlood = config.FirstBlood
|
||||||
fic.SubmissionCostBase = config.SubmissionCostBase
|
fic.SubmissionCostBase = config.SubmissionCostBase
|
||||||
|
@ -9,6 +9,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DisplayAllFlags doesn't respect the predefined constraint existing between flags.
|
||||||
|
var DisplayAllFlags bool
|
||||||
|
|
||||||
type myTeamFile struct {
|
type myTeamFile struct {
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -179,7 +182,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||||||
for _, k := range flags {
|
for _, k := range flags {
|
||||||
var flag myTeamFlag
|
var flag myTeamFlag
|
||||||
|
|
||||||
if t != nil && !t.CanSeeFlag(k) {
|
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(k) {
|
||||||
// Dependancy missing, skip the flag for now
|
// Dependancy missing, skip the flag for now
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -237,7 +240,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
for _, mcq := range mcqs {
|
for _, mcq := range mcqs {
|
||||||
if t != nil && !t.CanSeeFlag(mcq) {
|
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(mcq) {
|
||||||
// Dependancy missing, skip the flag for now
|
// Dependancy missing, skip the flag for now
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,8 @@ type FICSettings struct {
|
|||||||
UnlockedChallengeDepth int `json:"unlockedChallengeDepth"`
|
UnlockedChallengeDepth int `json:"unlockedChallengeDepth"`
|
||||||
// SubmissionUniqueness don't count multiple times identical tries.
|
// SubmissionUniqueness don't count multiple times identical tries.
|
||||||
SubmissionUniqueness bool `json:"submissionUniqueness"`
|
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 will ask browsers to delay notification interval.
|
||||||
EventKindness bool `json:"eventKindness"`
|
EventKindness bool `json:"eventKindness"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user