diff --git a/admin/sync/exercice_defines.go b/admin/sync/exercice_defines.go index e02c712e..e6f04494 100644 --- a/admin/sync/exercice_defines.go +++ b/admin/sync/exercice_defines.go @@ -27,13 +27,6 @@ type ExerciceUnlockFile struct { Filename string `toml:",omitempty"` } -// ExerciceFlagChoice holds informations about a choice (for MCQ and UCQ). -type ExerciceFlagChoice struct { - Label string `toml:",omitempty"` - Value interface{} `toml:",omitempty"` - Justification *ExerciceFlag `toml:",omitempty""` -} - // ExerciceFlag holds informations about one flag. type ExerciceFlag struct { Id int64 @@ -52,6 +45,12 @@ type ExerciceFlag struct { NoShuffle bool } +// ExerciceFlagChoice holds informations about a choice (for MCQ and UCQ). +type ExerciceFlagChoice struct { + ExerciceFlag + Value interface{} `toml:",omitempty"` +} + // ExerciceParams contains values parsed from defines.txt. type ExerciceParams struct { Gain int64 diff --git a/admin/sync/exercice_keys.go b/admin/sync/exercice_keys.go index 5e7c86b7..d0d93b8e 100644 --- a/admin/sync/exercice_keys.go +++ b/admin/sync/exercice_keys.go @@ -233,7 +233,7 @@ func buildExerciceFlags(i Importer, exercice fic.Exercice) (flags map[int64]impo for cid, choice := range flag.Choice { var val bool - if choice.Justification != nil { + if choice.Raw != nil { if hasOne && !isJustified { errs = append(errs, fmt.Sprintf("%q: error MCQ #%d: all true items has to be justified in this MCQ.", path.Base(exercice.Path), nline+1)) continue @@ -259,8 +259,8 @@ func buildExerciceFlags(i Importer, exercice fic.Exercice) (flags map[int64]impo Response: val, }) - if isJustified && choice.Justification != nil { - addedFlag, choices, berrs := buildKeyFlag(exercice, *choice.Justification, nline+1, "Flag correspondant") + if isJustified && choice.Raw != nil { + addedFlag, choices, berrs := buildKeyFlag(exercice, choice.ExerciceFlag, nline+1, "Flag correspondant") if len(berrs) > 0 { errs = append(errs, berrs...) }