feat(assessment): grade choice answers with distractors from error models
This commit is contained in:
1 parent
efa41d5967
commit
f1147b1885
22 files changed
+1346
-47
No files matched your search
@@ -387,6 +387,21 @@ func assessmentAnswerHTTPBodyWithCorrectness(
|
||||
if err != nil {
|
||||
t.Fatalf("marshal order answer: %v", err)
|
||||
}
|
||||
case domain.AnswerFormatChoice:
|
||||
chosen, err := strconv.Atoi(item.Variant.ReferenceAnswer)
|
||||
if err != nil || chosen < 0 || chosen >= len(item.Variant.Options) {
|
||||
t.Fatalf("frozen choice key %q does not name one of %d options", item.Variant.ReferenceAnswer, len(item.Variant.Options))
|
||||
}
|
||||
if !wantCorrect {
|
||||
chosen = (chosen + 1) % len(item.Variant.Options)
|
||||
}
|
||||
answer, err = json.Marshal(struct {
|
||||
Format string `json:"format"`
|
||||
OptionIDs []string `json:"option_ids"`
|
||||
}{Format: "choice", OptionIDs: []string{item.Variant.Options[chosen].ID}})
|
||||
if err != nil {
|
||||
t.Fatalf("marshal choice answer: %v", err)
|
||||
}
|
||||
default:
|
||||
t.Fatalf("unsupported fixture answer format %q", item.Variant.AnswerFormat)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user