Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…he maximum rating incorrectly for custom scales
  • Loading branch information...
commit 08f06b1c24868372c72053c47510d0bc5ec5ed30 1 parent 9ad535c
Andrew Davis andyjdavis authored

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. +4 2 rating/index.php
6 rating/index.php
@@ -102,8 +102,10 @@
102 102 $table->colclasses = array('', 'firstname', 'rating', 'time');
103 103 $table->data = array();
104 104
105   - //if the scale was changed after ratings were submitted some ratings may have a value above the current maximum
106   - $maxrating = count($scalemenu) - 1;
  105 + // If the scale was changed after ratings were submitted some ratings may have a value above the current maximum
  106 + // We can't just do count($scalemenu) - 1 as custom scales start at index 1, not 0
  107 + $maxrating = max(array_keys($scalemenu));
  108 +
107 109 foreach ($ratings as $rating) {
108 110 //Undo the aliasing of the user id column from user_picture::fields()
109 111 //we could clone the rating object or preserve the rating id if we needed it again

0 comments on commit 08f06b1

Please sign in to comment.
Something went wrong with that request. Please try again.