db: Add a published attribute, filled by challenge.txt
This commit is contained in:
parent
6b7ed273b7
commit
a28f108b8a
7 changed files with 75 additions and 19 deletions
|
|
@ -28,6 +28,12 @@ type ExerciceUnlockFile struct {
|
|||
Filename string `toml:",omitempty"`
|
||||
}
|
||||
|
||||
// ExerciceFile defines attributes on files.
|
||||
type ExerciceFile struct {
|
||||
Filename string `toml:",omitempty"`
|
||||
Hidden bool `toml:",omitempty"`
|
||||
}
|
||||
|
||||
// ExerciceFlag holds informations about one flag.
|
||||
type ExerciceFlag struct {
|
||||
Id int64
|
||||
|
|
@ -66,6 +72,7 @@ type ExerciceFlagChoice struct {
|
|||
type ExerciceParams struct {
|
||||
Gain int64
|
||||
Tags []string
|
||||
Files []ExerciceFile `toml:"file"`
|
||||
Hints []ExerciceHintParams `toml:"hint"`
|
||||
Dependencies []ExerciceDependency `toml:"depend"`
|
||||
Flags []ExerciceFlag `toml:"flag"`
|
||||
|
|
@ -127,3 +134,17 @@ func getExerciceParams(i Importer, exercice *fic.Exercice) (params ExerciceParam
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetExerciceFilesParams(i Importer, exercice *fic.Exercice) (map[string]ExerciceFile, error) {
|
||||
params, _, err := parseExerciceParams(i, exercice.Path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
paramsFiles := map[string]ExerciceFile{}
|
||||
for _, f := range params.Files {
|
||||
paramsFiles[f.Filename] = f
|
||||
}
|
||||
|
||||
return paramsFiles, nil
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue