public function ShortAnswerResponse::save in Quiz 7.5
Same name and namespace in other branches
- 6.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 6.3 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 6.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 6.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 7.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 7 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 7.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
Implementation of save().
Overrides QuizQuestionResponse::save
See also
File
- question_types/
short_answer/ short_answer.classes.inc, line 323 - Short answer classes.
Class
- ShortAnswerResponse
- Extension of QuizQuestionResponse.
Code
public function save() {
// We need to set is_evaluated depending on whether the type requires
// evaluation.
$this->is_evaluated = (int) ($this->question->correct_answer_evaluation != ShortAnswerQuestion::ANSWER_MANUAL);
db_merge('quiz_short_answer_user_answers')
->key(array(
'result_answer_id' => $this->result_answer_id,
))
->fields(array(
'answer' => $this->answer,
'result_answer_id' => $this->result_answer_id,
'score' => $this
->getScore(FALSE),
'is_evaluated' => $this->is_evaluated,
))
->execute();
}