Skip to content

Commit

Permalink
CTP-3560 avoid error if decorator passed
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Sep 30, 2024
1 parent 3013ae8 commit 7cd8b73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ function coursework_grade_item_update($coursework, $grades = null) {
throw new invalid_parameter_exception("Invalid type '$paramtype' for coursework");
}

if (get_class($coursework) != 'mod_coursework\models\coursework') {
// On activity rename, core will pass in stdClass object here, not a coursework.
if (get_class($coursework) == 'stdClass') {
// On activity rename, core will pass in stdClass object here.
// Otherwise expect coursework or coursework_groups_decorator to be passed.
$coursework = \mod_coursework\models\coursework::find($coursework);
}

Expand Down

0 comments on commit 7cd8b73

Please sign in to comment.