public function ShortAnswerResponse::score in Quiz 7
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.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
- 7.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::score()
Implementation of score
Overrides QuizQuestionResponse::score
See also
QuizQuestionResponse#score()
File
- question_types/
short_answer/ short_answer.classes.inc, line 401 - The main classes for the short answer question type.
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_id = :result_id AND question_vid = :question_vid', array(
':result_id' => $this->rid,
':question_vid' => $this->question->vid,
))
->fetchField();
}
else {
$shortAnswer = new ShortAnswerQuestion($this->question);
$score = $shortAnswer
->evaluateAnswer($this
->getResponse());
}
return $score;
}