admin: Fix bad names in update choices
This commit is contained in:
parent
3cb4e98bd1
commit
f4c74f57d6
3 changed files with 6 additions and 3 deletions
|
@ -365,7 +365,7 @@ type uploadedFlag struct {
|
||||||
ValidatorRe *string `json:"validator_regexp"`
|
ValidatorRe *string `json:"validator_regexp"`
|
||||||
Flag string
|
Flag string
|
||||||
Value []byte
|
Value []byte
|
||||||
ChoicesCost int64
|
ChoicesCost int64 `json:"choices_cost"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func createExerciceFlag(exercice fic.Exercice, body []byte) (interface{}, error) {
|
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.Help = uk.Help
|
||||||
flag.IgnoreCase = uk.IgnoreCase
|
flag.IgnoreCase = uk.IgnoreCase
|
||||||
|
flag.Multiline = uk.Multiline
|
||||||
if len(uk.Flag) > 0 {
|
if len(uk.Flag) > 0 {
|
||||||
var err error
|
var err error
|
||||||
flag.Checksum, err = flag.ComputeChecksum([]byte(uk.Flag))
|
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.Label = uc.Label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
choice.Value = uc.Value
|
||||||
|
|
||||||
if _, err := choice.Update(); err != nil {
|
if _, err := choice.Update(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
<label class="custom-control-label" for="kicase{{flag.id}}">Ignore case</label>
|
<label class="custom-control-label" for="kicase{{flag.id}}">Ignore case</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto custom-control custom-checkbox ml-1">
|
<div class="col-auto custom-control custom-checkbox ml-1">
|
||||||
<input type="checkbox" class="custom-control-input" id="kicase{{flag.id}}" ng-model="flag.multiline">
|
<input type="checkbox" class="custom-control-input" id="kmline{{flag.id}}" ng-model="flag.multiline">
|
||||||
<label class="custom-control-label" for="kmline{{flag.id}}">Multiline</label>
|
<label class="custom-control-label" for="kmline{{flag.id}}">Multiline</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (f FlagKey) AddChoice(c FlagChoice) (FlagChoice, error) {
|
||||||
|
|
||||||
// Update applies modifications back to the database.
|
// Update applies modifications back to the database.
|
||||||
func (c FlagChoice) Update() (int64, error) {
|
func (c FlagChoice) Update() (int64, error) {
|
||||||
if res, err := DBExec("UPDATE flag_choices SET id_flag = ?, label = ?, value = ? WHERE id_choice = ?", c.IdFlag, c.Label, c.Value, c.Id); err != nil {
|
if res, err := DBExec("UPDATE flag_choices SET id_flag = ?, label = ?, response = ? WHERE id_choice = ?", c.IdFlag, c.Label, c.Value, c.Id); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
} else if nb, err := res.RowsAffected(); err != nil {
|
} else if nb, err := res.RowsAffected(); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
Reference in a new issue