Merge branch 'MDL-26461_change_rating_scale' of git://github.com/andyjdavis/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 22 Feb 2011 10:06:23 +0000 (11:06 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 22 Feb 2011 10:06:23 +0000 (11:06 +0100)
1  2 
rating/index.php

diff --combined rating/index.php
@@@ -92,12 -92,13 +92,13 @@@ if (!$ratings) 
      echo "<th class=\"header\" scope=\"col\"><a href=\"index.php?$sortargs&amp;sort=time\">$strtime</a></th>";
      echo "</tr>";
  
-     $maxrating = count($scalemenu);
+     //if the scale was changed after ratings were submitted some ratings may have a value above the current maximum
+     $maxrating = count($scalemenu) - 1;
      foreach ($ratings as $rating) {
          //Undo the aliasing of the user id column from user_picture::fields()
          //we could clone the rating object or preserve the rating id if we needed it again
          //but we don't
 -        $rating->id = $rating->uid;
 +        $rating->id = $rating->userid;
  
          echo '<tr class="ratingitemheader">';
          echo "<td>";