sync: Refactor exercice flags
This commit is contained in:
parent
1e183f60ee
commit
ff3dec059c
2 changed files with 238 additions and 232 deletions
|
|
@ -25,54 +25,23 @@ type ExerciceUnlockFile struct {
|
|||
Filename string `toml:",omitempty"`
|
||||
}
|
||||
|
||||
// ExerciceFlag holds informations about a "classic" flag.
|
||||
// ExerciceFlag holds informations about one flag.
|
||||
type ExerciceFlag struct {
|
||||
Id int64
|
||||
Label string `toml:",omitempty"`
|
||||
Type string `toml:",omitempty"`
|
||||
Raw interface{}
|
||||
Value interface{} `toml:",omitempty"`
|
||||
Separator string `toml:",omitempty"`
|
||||
Ordered bool `toml:",omitempty"`
|
||||
IgnoreCase bool `toml:",omitempty"`
|
||||
ValidatorRe string `toml:"validator_regexp,omitempty"`
|
||||
Help string `toml:",omitempty"`
|
||||
ChoicesCost int64 `toml:"choices_cost,omitempty"`
|
||||
Choice []ExerciceFlag
|
||||
LockedFile []ExerciceUnlockFile `toml:"unlock_file,omitempty"`
|
||||
NeedFlag []ExerciceDependency `toml:"need_flag,omitempty"`
|
||||
}
|
||||
|
||||
// ExerciceFlagMCQChoice holds a choice for an MCQ flag.
|
||||
type ExerciceFlagMCQChoice struct {
|
||||
Label string
|
||||
Value interface{} `toml:",omitempty"`
|
||||
Help string `toml:",omitempty"`
|
||||
}
|
||||
|
||||
// ExerciceFlagMCQ holds information about a MCQ flag.
|
||||
type ExerciceFlagMCQ struct {
|
||||
Label string `toml:",omitempty"`
|
||||
Choice []ExerciceFlagMCQChoice
|
||||
NoShuffle bool
|
||||
}
|
||||
|
||||
// ExerciceFlagUCQChoice holds a choice for an UCQ flag.
|
||||
type ExerciceFlagUCQChoice struct {
|
||||
Label string `toml:",omitempty"`
|
||||
Value string
|
||||
}
|
||||
|
||||
// ExerciceFlagUCQ holds information about a UCQ flag.
|
||||
type ExerciceFlagUCQ struct {
|
||||
Id int64
|
||||
Label string `toml:",omitempty"`
|
||||
Raw string
|
||||
IgnoreCase bool `toml:",omitempty"`
|
||||
ValidatorRe string `toml:"validator_regexp,omitempty"`
|
||||
Help string `toml:",omitempty"`
|
||||
DisplayAs string `toml:",omitempty"`
|
||||
ChoicesCost int64 `toml:"choices_cost,omitempty"`
|
||||
Choice []ExerciceFlagUCQChoice
|
||||
LockedFile []ExerciceUnlockFile `toml:"unlock_file,omitempty"`
|
||||
NeedFlag []ExerciceDependency `toml:"need_flag,omitempty"`
|
||||
NoShuffle bool
|
||||
NoShuffle bool
|
||||
}
|
||||
|
||||
// ExerciceParams contains values parsed from defines.txt.
|
||||
|
|
@ -82,8 +51,8 @@ type ExerciceParams struct {
|
|||
Hints []ExerciceHintParams `toml:"hint"`
|
||||
Dependencies []ExerciceDependency `toml:"depend"`
|
||||
Flags []ExerciceFlag `toml:"flag"`
|
||||
FlagsMCQ []ExerciceFlagMCQ `toml:"flag_mcq"`
|
||||
FlagsUCQ []ExerciceFlagUCQ `toml:"flag_ucq"`
|
||||
FlagsMCQ []ExerciceFlag `toml:"flag_mcq"`
|
||||
FlagsUCQ []ExerciceFlag `toml:"flag_ucq"`
|
||||
}
|
||||
|
||||
// parseExerciceParams reads challenge definitions from defines.txt and extract usefull data to set up the challenge.
|
||||
|
|
|
|||
Reference in a new issue