Skip to content
Snippets Groups Projects
Commit 0434549e authored by falcon's avatar falcon
Browse files

#635580 reported by neorg: Fixed: Total score can be higher then total max...

#635580 reported by neorg: Fixed: Total score can be higher then total max score when quiz is finished...
parent ba3546bb
No related branches found
No related tags found
No related merge requests found
......@@ -657,7 +657,7 @@ abstract class AbstractQuizQuestionResponse implements QuizQuestionResponse {
return $this->score;
}
function getMaxScore($weight_adjusted = TRUE) {
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 $this->question->max_score * $this->question->score_weight;
......
......@@ -329,11 +329,11 @@ function quiz_question_quiz_question_score($quiz, $question_nid, $question_vid =
$score->question_vid = $question->node->vid;
if (isset($rid)) {
$max_score = $question->node->max_score;
//$max_score = $question->node->max_score;
$response = _quiz_question_response_get_instance($rid, $question->node);
$score->attained = $score->possible > 0 ? round($response->getScore()) : 0;
$score->possible = $max_score;
//$score->possible = $max_score;
$score->possible = $response->getMaxScore();
$score->is_evaluated = $response->isEvaluated();
}
......
......@@ -2696,6 +2696,7 @@ function _quiz_get_answers($rid) {
if (!isset($questions[$line->question_nid]->score_weight)) {
if ($questions[$line->question_nid]->max_score == 0) $weight = 0;
else $weight = $line->max_score / $questions[$line->question_nid]->max_score;
$questions[$line->question_nid]->qnr_max_score = $line->max_score;
$questions[$line->question_nid]->score_weight = $weight;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment