Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit f92305bfa9a16db1c2033b5f1ef36c275280513f 1 parent 0b4767c
@andyjdavis andyjdavis authored samhemelryk committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/grade/grade_category.php
View
6 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;
}
@@ -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++;
Please sign in to comment.
Something went wrong with that request. Please try again.