public function ShortAnswerResponse::score in Quiz 7.5
Same name and namespace in other branches
- 6.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
- 6.3 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
- 6.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
- 6.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
- 7.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
- 7 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
- 7.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
Implementation of score().
Overrides QuizQuestionResponse::score
See also
1 call to ShortAnswerResponse::score()
- ShortAnswerResponse::getFeedbackValues in question_types/
short_answer/ short_answer.classes.inc - Implementation of getFeedbackValues().
File
- question_types/
short_answer/ short_answer.classes.inc, line 354 - Short answer classes.
Class
- ShortAnswerResponse
- Extension of QuizQuestionResponse.
Code
public function score() {
// Manual scoring means we go with what is in the DB.
if ($this->question->correct_answer_evaluation == ShortAnswerQuestion::ANSWER_MANUAL) {
$score = db_query('SELECT score FROM {quiz_short_answer_user_answers} WHERE result_answer_id = :raid', array(
':raid' => $this->result_answer_id,
))
->fetchField();
if (!$score) {
$score = 0;
}
}
else {
$shortAnswer = new ShortAnswerQuestion($this->question);
$score = $shortAnswer
->evaluateAnswer($this
->getResponse());
}
return $score;
}