Skip to content

Commit

Permalink
fix wrong error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Glutamat42 committed Oct 9, 2024
1 parent e60bf24 commit c0c867c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ public function upgrade_modules(): void {
* @throws dml_exception
*/
public function upgrade_h5p_module(stdClass $cm_info): void {
$grade_item = $this->moodle_core_repository->get_grade_item('h5pactivity', $cm_info->instance);
if ($grade_item) {
try {
$grade_item = $this->moodle_core_repository->get_grade_item('h5pactivity', $cm_info->instance);
$this->logger->info('Setting completion for h5p cm ' . $cm_info->id . ' to "passing grade"');
$this->set_completion_to_auto($cm_info, false);
$this->moodle_core_repository->update_grade_item_record($grade_item->id, [
'gradepass' => $grade_item->grademax
]);
} else {
} catch (dml_exception $e) {
$this->logger->error('No grade item found for h5p cm ' . $cm_info->id);
}
}
Expand Down

0 comments on commit c0c867c

Please sign in to comment.