public function TrueFalseResponse::score in Quiz 8.4
Implementation of score
Overrides QuizQuestionResponse::score
See also
QuizQuestionResponse#score()
File
- question_types/
truefalse/ lib/ Drupal/ truefalse/ TrueFalseResponse.php, line 75
Class
Namespace
Drupal\truefalseCode
public function score() {
$tfQuestion = new TrueFalseQuestion($this->question);
return $this
->getResponse() == $tfQuestion
->getCorrectAnswer() ? 1 : 0;
}