You are here

public function QuizQuestionResponse::getWeightedRatio in Quiz 7.5

Get the weighted score ratio.

This returns the ratio of the weighted score of this question versus the question score. For example, if the question is worth 10 points in the associated quiz, but it is a 3 point multichoice question, the weighted ratio is 3.33.

Return value

float The weight of the question

1 call to QuizQuestionResponse::getWeightedRatio()
QuizQuestionResponse::getScore in question_types/quiz_question/quiz_question.core.inc
Get the score of this question response.

File

question_types/quiz_question/quiz_question.core.inc, line 938
Classes used in the Quiz Question module.

Class

QuizQuestionResponse
Each question type must store its own response data and be able to calculate a score for that data.

Code

public function getWeightedRatio() {
  if ($this
    ->getMaxScore(FALSE) == 0) {
    return 0;
  }
  return $this
    ->getMaxScore(TRUE) / $this
    ->getMaxScore(FALSE);
}