Skip to content

Commit

Permalink
Propagates answer field type in cloze questions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pol Torrent committed May 6, 2021
1 parent 80c5504 commit fc18f53
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ private function set_shortanswer_matching_answers(array $response) {
$qimpl->setAssertion("equivalent_symbolic", 0, 0);
}

// Since we are generating all the slots artificially by cloning the first one,
// set its answer field type as the default for the question.
$slots = $qimpl->slots;
if ($slots != null && isset($slots[0])) {
$answerFieldType = $slots[0]->getAnswerFieldType();
$qimpl->setAnswerFieldType($answerFieldType);
}

// Remove all non-syntactic assertions from question and save to $assertions array.
for ($i = $qimpl->assertions->length - 1; $i >= 0; $i--) {
$assertion = $qimpl->assertions[$i];
Expand Down

0 comments on commit fc18f53

Please sign in to comment.