public function MultichoiceQuestion::getMaximumScore in Quiz 8.4
Implementation of getMaximumScore.
Overrides QuizQuestion::getMaximumScore
See also
QuizQuestion#getMaximumScore()
File
- question_types/
multichoice/ lib/ Drupal/ multichoice/ MultichoiceQuestion.php, line 754 - The main classes for the multichoice question type.
Class
- MultichoiceQuestion
- Extension of QuizQuestion.
Namespace
Drupal\multichoiceCode
public function getMaximumScore() {
if ($this->node->choice_boolean) {
return 1;
}
$max = 0;
for ($i = 0; isset($this->node->alternatives[$i]); $i++) {
$short = $this->node->alternatives[$i];
if ($this->node->choice_multi) {
$max += max($short['score_if_chosen'], $short['score_if_not_chosen']);
}
else {
$max = max($max, $short['score_if_chosen'], $short['score_if_not_chosen']);
}
}
return max($max, 1);
}