MDL-79863 qtype_ordering: qtype_ordering fix handling of unscored items in grading details during review of question attempt

This commit is contained in:
Gordon Bateson 2016-01-02 15:33:02 +09:00 committed by Mathew May
parent 46abdfc86e
commit 5724882c2f
3 changed files with 12 additions and 5 deletions

View File

@ -43,6 +43,7 @@ $string['horizontal'] = 'Horizontal';
$string['layouttype_help'] = 'Choose whether to display the items vertically or horizontally.';
$string['layouttype'] = 'Layout of items';
$string['noresponsedetails'] = 'Sorry, no details of the response to this question are available.';
$string['noscore'] = 'No score';
$string['notenoughanswers'] = 'Ordering questions must have more than {$a} answers.';
$string['relativeallpreviousandnext'] = 'Relative to ALL the previous and next items';
$string['relativenextexcludelast'] = 'Relative to the next item (excluding last)';

View File

@ -209,9 +209,13 @@ class qtype_ordering_renderer extends qtype_with_combined_feedback_renderer {
$answer = $question->answers[$answerid];
$score = $this->get_ordering_item_score($question, $position, $answerid);
list($score, $maxscore, $fraction, $percent, $class, $img) = $score;
$totalscore += $score;
$totalmaxscore += $maxscore;
$score = "$score / $maxscore = $percent%";
if ($maxscore===null) {
$score = get_string('noscore', $plugin);
} else {
$totalscore += $score;
$totalmaxscore += $maxscore;
$score = "$score / $maxscore = $percent%";
}
$scoredetails .= html_writer::tag('li', $score, $params);
}
@ -310,6 +314,8 @@ class qtype_ordering_renderer extends qtype_with_combined_feedback_renderer {
$maxscore = null; // max score for this item
$fraction = 0.0; // $score / $maxscore
$percent = 0; // 100 * $fraction
$class = ''; // CSS class
$img = ''; // icon to show correctness
switch ($question->options->gradingtype) {

View File

@ -31,5 +31,5 @@ $plugin->cron = 0;
$plugin->component = 'qtype_ordering';
$plugin->maturity = MATURITY_STABLE;
$plugin->requires = 2010112400; // Moodle 2.0
$plugin->version = 2016010136;
$plugin->release = '2016-01-01 (36)';
$plugin->version = 2016010237;
$plugin->release = '2016-01-02 (37)';