admin: Fix bad names in update choices

This commit is contained in:
nemunaire 2020-01-28 10:49:12 +01:00
parent 3cb4e98bd1
commit f4c74f57d6
3 changed files with 6 additions and 3 deletions

View file

@ -365,7 +365,7 @@ type uploadedFlag struct {
ValidatorRe *string `json:"validator_regexp"`
Flag string
Value []byte
ChoicesCost int64
ChoicesCost int64 `json:"choices_cost"`
}
func createExerciceFlag(exercice fic.Exercice, body []byte) (interface{}, error) {
@ -425,6 +425,7 @@ func updateExerciceFlag(flag fic.FlagKey, exercice fic.Exercice, body []byte) (i
flag.Help = uk.Help
flag.IgnoreCase = uk.IgnoreCase
flag.Multiline = uk.Multiline
if len(uk.Flag) > 0 {
var err error
flag.Checksum, err = flag.ComputeChecksum([]byte(uk.Flag))
@ -482,6 +483,8 @@ func updateFlagChoice(choice fic.FlagChoice, _ fic.Exercice, body []byte) (inter
choice.Label = uc.Label
}
choice.Value = uc.Value
if _, err := choice.Update(); err != nil {
return nil, err
}