Skip to content

Commit

Permalink
MDL-30955 rating: corrected /rating/index.php as it was determining t…
Browse files Browse the repository at this point in the history
…he maximum rating incorrectly for custom scales
  • Loading branch information
andyjdavis committed Apr 10, 2012
1 parent 9ad535c commit 08f06b1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rating/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@
$table->colclasses = array('', 'firstname', 'rating', 'time');
$table->data = array();

//if the scale was changed after ratings were submitted some ratings may have a value above the current maximum
$maxrating = count($scalemenu) - 1;
// If the scale was changed after ratings were submitted some ratings may have a value above the current maximum
// We can't just do count($scalemenu) - 1 as custom scales start at index 1, not 0
$maxrating = max(array_keys($scalemenu));

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
Expand Down

0 comments on commit 08f06b1

Please sign in to comment.