You are here

public function QuizQuestionResponse::getMaxScore in Quiz 7

Same name and namespace in other branches
  1. 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
  2. 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
  3. 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
  4. 7.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()

Returns stored max score if it exists, if not the max score is calculated and returned.

Parameters

$weight_adjusted: If the returned max score shall be adjusted according to the max_score the question has in a quiz

Return value

Max score(int)

2 calls to QuizQuestionResponse::getMaxScore()
QuizQuestionResponse::getReportForm in question_types/quiz_question/quiz_question.core.inc
Creates the report form for the admin pages, and for when a user gets feedback after answering questions.
QuizQuestionResponse::isCorrect in question_types/quiz_question/quiz_question.core.inc
Check to see if the answer is marked as correct.

File

question_types/quiz_question/quiz_question.core.inc, line 711
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 getMaxScore($weight_adjusted = TRUE) {
  if (!isset($this->question->max_score)) {
    $this->question->max_score = $this->question
      ->getMaximumScore();
  }
  if (isset($this->question->score_weight) && $weight_adjusted) {
    return round($this->question->max_score * $this->question->score_weight);
  }
  return $this->question->max_score;
}