libfic/mcq: remove Kind, as we can only handle checkbox; another kind of record should be created to handle select/radio
This commit is contained in:
parent
ebd4b1e516
commit
eb182ff6e6
4 changed files with 11 additions and 20 deletions
|
|
@ -71,7 +71,7 @@ func SyncExerciceMCQ(i Importer, exercice fic.Exercice) []string {
|
|||
// Unique Choice Questions (checkbox)
|
||||
if ucq, err := getFileContent(i, path.Join(exercice.Path, "flags-ucq.txt")); err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: unable to read ucq: %s", path.Base(exercice.Path), err))
|
||||
} else if flag, err := exercice.AddMCQ("", "checkbox"); err != nil {
|
||||
} else if flag, err := exercice.AddMCQ(""); err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: unable to add ucq: %s", path.Base(exercice.Path), err))
|
||||
} else {
|
||||
for nline, quest := range strings.Split(ucq, "\n") {
|
||||
|
|
@ -107,7 +107,7 @@ func SyncExerciceMCQ(i Importer, exercice fic.Exercice) []string {
|
|||
continue
|
||||
}
|
||||
|
||||
if flag, err := exercice.AddMCQ(quest_splt[0], "radio"); err != nil {
|
||||
if flag, err := exercice.AddMCQ(quest_splt[0]); err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: error in mcq file at line %d: %s", path.Base(exercice.Path), nline + 1, err))
|
||||
continue
|
||||
} else {
|
||||
|
|
@ -130,13 +130,7 @@ func SyncExerciceMCQ(i Importer, exercice fic.Exercice) []string {
|
|||
}
|
||||
|
||||
if choice[0] == 49 {
|
||||
if hasOne {
|
||||
flag.Kind = "checkbox"
|
||||
flag.Update()
|
||||
errs = append(errs, fmt.Sprintf("%q: warning in mcq file at line %d: multiple expected response, switching to ucq-like quiz; is this really expected?", path.Base(exercice.Path), nline + 1))
|
||||
} else {
|
||||
hasOne = true
|
||||
}
|
||||
hasOne = true
|
||||
}
|
||||
}
|
||||
if !hasOne {
|
||||
|
|
|
|||
Reference in a new issue