public function QuizQuestionResponse::getMaxScore in Quiz 7.6
Same name and namespace in other branches
- 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
- 7 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
- 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
- 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)
4 calls to QuizQuestionResponse::getMaxScore()
- MultichoiceResponse::score in question_types/
multichoice/ multichoice.classes.inc - Implementation of score
- QuizQuestionResponse::getFeedback in question_types/
quiz_question/ quiz_question.core.inc - Returns a renderable array of question feedback.
- QuizQuestionResponse::getReportFormScore in question_types/
quiz_question/ quiz_question.core.inc - Implementation of getReportFormScore
- 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 568 - 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->quizQuestion
->getMaximumScore();
}
if (isset($this->question->score_weight) && $weight_adjusted) {
return round($this->question->max_score * $this->question->score_weight);
}
return $this->question->max_score;
}