You are here

public function QuizQuestionResponse::getMaxScore in OG Quiz 7

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 includes/og_quiz_question.php
Creates the report form for the admin pages, and for when a user gets feedback after answering questions.
QuizQuestionResponse::isCorrect in includes/og_quiz_question.php
Check to see if the answer is marked as correct.

File

includes/og_quiz_question.php, line 916
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 = 1;
  }
  if (isset($this->question->score_weight) && $weight_adjusted) {
    return round($this->question->max_score * $this->question->score_weight);
  }
  return $this->question->max_score;
}