Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-30955 rating: corrected /rating/index.php as it was determining t…

…he maximum rating incorrectly for custom scales
  • Loading branch information...
commit 92a7892d421da09a7f257389ed194d888e5c63ac 1 parent 832626d
@andyjdavis andyjdavis authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 rating/index.php
View
6 rating/index.php
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.