Permalink
Browse files

MDL-36761 core_grade:shifted a call to count() out of a loop

  • Loading branch information...
1 parent 5f1d8f2 commit b10a46738a830e24d8fb2f36b80de4205dce5d85 @andyjdavis andyjdavis committed Nov 27, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/grade/grade_category.php
@@ -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;
}
@@ -910,7 +912,7 @@ public function apply_limit_rules(&$grade_values, $items) {
}
$i = 1;
- while ($originalindex+$i < count($grade_keys)) {
+ while ($originalindex + $i < $gradekeycount) {
$possibleitemid = $grade_keys[$originalindex+$i];
$i++;

0 comments on commit b10a467

Please sign in to comment.