Skip to content

Commit

Permalink
Merge branch 'MDL-61950-master' of git://github.com/ryanwyllie/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Apr 18, 2018
2 parents 6979cf5 + 40633c6 commit 3a37a5e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions question/classes/statistics/questions/calculator.php
Expand Up @@ -181,16 +181,15 @@ public function calculate($qubaids) {

// Finish computing the averages, and put the sub-question data into the
// corresponding questions.

// This cannot be a foreach loop because we need to have both
// $question and $nextquestion available, but apart from that it is
// foreach ($this->questions as $qid => $question).
$slots = $this->stats->get_all_slots();
$this->progress->start_progress('', count($slots), 1);
foreach ($slots as $slot) {
$totalnumberofslots = count($slots);
$maxindex = $totalnumberofslots - 1;
$this->progress->start_progress('', $totalnumberofslots, 1);
foreach ($slots as $index => $slot) {
$this->stats->for_slot($slot)->sort_variants();
$this->progress->increment_progress();
$nextslot = current($slots);
$nextslotindex = $index + 1;
$nextslot = ($nextslotindex > $maxindex) ? false : $slots[$nextslotindex];

$this->initial_question_walker($this->stats->for_slot($slot));

Expand Down

0 comments on commit 3a37a5e

Please sign in to comment.