You are here

function QuizQuestionResponse::getScore in Quiz 7.6

Same name and namespace in other branches
  1. 6.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
  2. 6.3 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
  3. 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
  4. 6.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
  5. 7 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
  6. 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getScore()
  7. 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)

7 calls to QuizQuestionResponse::getScore()
LongAnswerResponse::getFeedbackValues in question_types/long_answer/long_answer.classes.inc
Implementation of getReportFormResponse
QuizQuestionResponse::getFeedback in question_types/quiz_question/quiz_question.core.inc
Returns a renderable array of question feedback.
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
Implementation of getReportFormScore
QuizQuestionResponse::isCorrect in question_types/quiz_question/quiz_question.core.inc
Check to see if the answer is marked as correct.

... See full list

File

question_types/quiz_question/quiz_question.core.inc, line 547
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;
}