Merge branch 'MDL-63761-35' of git://github.com/damyon/moodle into MOODLE_35_STABLE

This commit is contained in:
Jake Dallimore 2019-01-09 09:07:56 +08:00
commit c00f5586f3

View file

@ -1112,7 +1112,7 @@ function grade_recover_history_grades($userid, $courseid) {
* *
* @param int $courseid The course ID * @param int $courseid The course ID
* @param int $userid If specified try to do a quick regrading of the grades of this user only * @param int $userid If specified try to do a quick regrading of the grades of this user only
* @param object $updated_item Optional grade item to be marked for regrading * @param object $updated_item Optional grade item to be marked for regrading. It is required if $userid is set.
* @param \core\progress\base $progress If provided, will be used to update progress on this long operation. * @param \core\progress\base $progress If provided, will be used to update progress on this long operation.
* @return bool true if ok, array of errors if problems found. Grade item id => error message * @return bool true if ok, array of errors if problems found. Grade item id => error message
*/ */
@ -1191,7 +1191,6 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null,
$failed = 0; $failed = 0;
while (count($finalids) < count($gids)) { // work until all grades are final or error found while (count($finalids) < count($gids)) { // work until all grades are final or error found
$count = 0;
foreach ($gids as $gid) { foreach ($gids as $gid) {
if (in_array($gid, $finalids)) { if (in_array($gid, $finalids)) {
continue; // already final continue; // already final
@ -1265,7 +1264,6 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null,
} else { } else {
$grade_items[$gid]->needsupdate = 0; $grade_items[$gid]->needsupdate = 0;
} }
$count++;
$finalids[] = $gid; $finalids[] = $gid;
$updatedids[] = $gid; $updatedids[] = $gid;
@ -1275,7 +1273,7 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null,
} }
} }
if ($count == 0) { if (count($finalids) == 0) {
$failed++; $failed++;
} else { } else {
$failed = 0; $failed = 0;