Skip to content

Commit

Permalink
MDL-36761 core_grade:shifted a call to count() out of a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjdavis committed Nov 30, 2012
1 parent f42c34a commit aee968d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/grade/grade_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,9 @@ public function apply_limit_rules(&$grade_values, $items) {
$droppedsomething = false;

$grade_keys = array_keys($grade_values);
if (count($grade_keys) === 0) {
$gradekeycount = count($grade_keys);

if ($gradekeycount === 0) {
//We've dropped all grade items
break;
}
Expand All @@ -912,7 +914,7 @@ public function apply_limit_rules(&$grade_values, $items) {
// Now iterate over the remaining grade items
// We're looking for other grade items with the same grade value but a higher grademax
$i = 1;
while ($originalindex+$i < count($grade_keys)) {
while ($originalindex + $i < $gradekeycount) {

$possibleitemid = $grade_keys[$originalindex+$i];
$i++;
Expand Down

0 comments on commit aee968d

Please sign in to comment.