You are here

public function ShortAnswerResponse::isCorrect in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::isCorrect()
  2. 6.3 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::isCorrect()

Check to see if the answer is marked as correct.

This default version returns TRUE iff the score is equal to the maximum possible score.

Overrides AbstractQuizQuestionResponse::isCorrect

File

question_types/short_answer/short_answer.classes.inc, line 338
The main classes for the short answer question type.

Class

ShortAnswerResponse
The short answer question response class.

Code

public function isCorrect() {
  $possible = _quiz_question_get_instance($this->question)
    ->getMaximumScore();
  $actual = $this->score;
  return $possible > 0 ? $actual / $possible > 0.5 : 0;
}