You are here

public function QuizQuestionResponse::getMaxScore in Quiz 8.4

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)

3 calls to QuizQuestionResponse::getMaxScore()
MultichoiceResponse::score in question_types/multichoice/lib/Drupal/multichoice/MultichoiceResponse.php
Implementation of score
QuizQuestionResponse::getReportForm in question_types/quiz_question/lib/Drupal/quiz_question/QuizQuestionResponse.php
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/lib/Drupal/quiz_question/QuizQuestionResponse.php
Check to see if the answer is marked as correct.

File

question_types/quiz_question/lib/Drupal/quiz_question/QuizQuestionResponse.php, line 112

Class

QuizQuestionResponse

Namespace

Drupal\quiz_question

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;
}