mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-64609 gradebook: Prevent infinite loop in regrading
This commit is contained in:
parent
4c6ae316d8
commit
85fec2b605
2 changed files with 51 additions and 2 deletions
|
@ -1191,6 +1191,7 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null,
|
|||
$failed = 0;
|
||||
|
||||
while (count($finalids) < count($gids)) { // work until all grades are final or error found
|
||||
$count = 0;
|
||||
foreach ($gids as $gid) {
|
||||
if (in_array($gid, $finalids)) {
|
||||
continue; // already final
|
||||
|
@ -1245,7 +1246,7 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null,
|
|||
if ($updateddependencies === false) {
|
||||
// If no direct descendants are marked as updated, then we don't need to update this grade item. We then mark it
|
||||
// as final.
|
||||
|
||||
$count++;
|
||||
$finalids[] = $gid;
|
||||
continue;
|
||||
}
|
||||
|
@ -1264,6 +1265,7 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null,
|
|||
} else {
|
||||
$grade_items[$gid]->needsupdate = 0;
|
||||
}
|
||||
$count++;
|
||||
$finalids[] = $gid;
|
||||
$updatedids[] = $gid;
|
||||
|
||||
|
@ -1273,7 +1275,7 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null,
|
|||
}
|
||||
}
|
||||
|
||||
if (count($finalids) == 0) {
|
||||
if ($count == 0) {
|
||||
$failed++;
|
||||
} else {
|
||||
$failed = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue