function QuizQuestionResponse::getScore in Quiz 7.4
Same name and namespace in other branches
- 6.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
- 6.3 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
- 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
- 6.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
- 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
- 7 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
- 7.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
Returns stored score if it exists, if not the score is calculated and returned.
Parameters
$weight_adjusted: If the returned score shall be adjusted according to the max_score the question has in a quiz
Return value
Score(int)
6 calls to QuizQuestionResponse::getScore()
- LongAnswerResponse::getReportFormScore in question_types/
long_answer/ long_answer.classes.inc - Implementation of getReportFormScore
- QuizQuestionResponse::getReport in question_types/
quiz_question/ quiz_question.core.inc - Get data suitable for reporting a user's score on the question. This expects an object with the following attributes:
- QuizQuestionResponse::getReportFormScore in question_types/
quiz_question/ quiz_question.core.inc - Get the score part of the report form
- QuizQuestionResponse::isCorrect in question_types/
quiz_question/ quiz_question.core.inc - Check to see if the answer is marked as correct.
- QuizQuestionResponse::toBareObject in question_types/
quiz_question/ quiz_question.core.inc - Represent the response as a stdClass object.
File
- question_types/
quiz_question/ quiz_question.core.inc, line 732 - 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
function getScore($weight_adjusted = TRUE) {
if ($this->is_skipped) {
return 0;
}
if (!isset($this->score)) {
$this->score = $this
->score();
}
if (isset($this->question->score_weight) && $weight_adjusted) {
return round($this->score * $this->question->score_weight);
}
return $this->score;
}