sync: Allow justified as flag type
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
651d428223
commit
eeced21be8
@ -355,8 +355,10 @@ func buildExerciceFlag(i Importer, exercice *fic.Exercice, flag ExerciceFlag, nl
|
|||||||
flag.Type = "radio"
|
flag.Type = "radio"
|
||||||
case "mcq":
|
case "mcq":
|
||||||
flag.Type = "mcq"
|
flag.Type = "mcq"
|
||||||
|
case "justified":
|
||||||
|
flag.Type = "justified"
|
||||||
default:
|
default:
|
||||||
errs = multierr.Append(errs, NewFlagError(exercice, &flag, nline+1, fmt.Errorf("invalid type of flag: should be 'key', 'number', 'text', 'mcq', 'ucq', 'radio' or 'vector'")))
|
errs = multierr.Append(errs, NewFlagError(exercice, &flag, nline+1, fmt.Errorf("invalid type of flag: should be 'key', 'number', 'text', 'mcq', 'justified', 'ucq', 'radio' or 'vector'")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +406,7 @@ func buildExerciceFlag(i Importer, exercice *fic.Exercice, flag ExerciceFlag, nl
|
|||||||
Choices: choices,
|
Choices: choices,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if flag.Type == "mcq" {
|
} else if flag.Type == "mcq" || flag.Type == "justified" {
|
||||||
addedFlag := fic.MCQ{
|
addedFlag := fic.MCQ{
|
||||||
IdExercice: exercice.Id,
|
IdExercice: exercice.Id,
|
||||||
Order: int8(nline + 1),
|
Order: int8(nline + 1),
|
||||||
@ -413,7 +415,7 @@ func buildExerciceFlag(i Importer, exercice *fic.Exercice, flag ExerciceFlag, nl
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasOne := false
|
hasOne := false
|
||||||
isJustified := false
|
isJustified := flag.Type == "justified"
|
||||||
|
|
||||||
if len(flag.Variant) != 0 {
|
if len(flag.Variant) != 0 {
|
||||||
errs = multierr.Append(errs, NewFlagError(exercice, &flag, nline+1, fmt.Errorf("variant is not defined for this kind of flag")))
|
errs = multierr.Append(errs, NewFlagError(exercice, &flag, nline+1, fmt.Errorf("variant is not defined for this kind of flag")))
|
||||||
|
Loading…
Reference in New Issue
Block a user