public function QuizResultAnswerEntityTrait::isCorrect in Quiz 8.5
Same name and namespace in other branches
- 8.6 src/Entity/QuizResultAnswerEntityTrait.php \Drupal\quiz\Entity\QuizResultAnswerEntityTrait::isCorrect()
- 6.x src/Entity/QuizResultAnswerEntityTrait.php \Drupal\quiz\Entity\QuizResultAnswerEntityTrait::isCorrect()
Check to see if the answer is marked as correct.
This default version returns TRUE if the score is equal to the maximum possible score. Each question type can determine on its own if the question response is "correct". For example a multiple choice question with 4 correct answers could be considered correct in different configurations.
Return value
bool
2 methods override QuizResultAnswerEntityTrait::isCorrect()
- QuizDirectionsResponse::isCorrect in question_types/
quiz_directions/ src/ Plugin/ quiz/ QuizQuestion/ QuizDirectionsResponse.php - Check to see if the answer is marked as correct.
- QuizPageResponse::isCorrect in question_types/
quiz_page/ src/ Plugin/ quiz/ QuizQuestion/ QuizPageResponse.php - Implementation of isCorrect().
File
- src/
Entity/ QuizResultAnswerEntityTrait.php, line 61
Class
- QuizResultAnswerEntityTrait
- Each question type must store its own response data and be able to calculate a score for that data.
Namespace
Drupal\quiz\EntityCode
public function isCorrect() {
return $this
->getMaxScore() == $this
->getPoints();
}