frontend: expose UCQ choices

This commit is contained in:
nemunaire 2018-11-28 04:37:08 +01:00
commit 01368dd6f4
2 changed files with 15 additions and 2 deletions

View file

@ -33,6 +33,7 @@ type myTeamFlag struct {
Help string `json:"help,omitempty"`
Solved *time.Time `json:"found,omitempty"`
Soluce string `json:"soluce,omitempty"`
Choices map[string]string `json:"choices,omitempty"`
}
type myTeamExercice struct {
ThemeId int `json:"theme_id"`
@ -173,7 +174,18 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
}
flag.Label = k.Label
flag.Help = k.Help
if flag.Solved == nil {
flag.Help = k.Help
if choices, err := k.GetChoices(); err != nil {
return nil, err
} else {
flag.Choices = map[string]string{}
for _, c := range choices {
flag.Choices[c.Value] = c.Label
}
}
}
exercice.Flags[k.Id] = flag
}