diff --git a/lib.php b/lib.php index 3f3e735..d754522 100644 --- a/lib.php +++ b/lib.php @@ -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); }