Skip to content

Commit

Permalink
Merge pull request #180 from aneno-m-e/copy-default-on-course-creation
Browse files Browse the repository at this point in the history
Disable by default if course has no recompletion settings and prevent reset when recompletion is disabled in course
  • Loading branch information
danmarsden authored Jul 17, 2024
2 parents 0844489 + 0ff76ed commit 9853042
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion classes/recompletion_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function definition() {
self::RECOMPLETION_TYPE_ONDEMAND => get_string('recompletiontype:ondemand', 'local_recompletion'),
self::RECOMPLETION_TYPE_SCHEDULE => get_string('recompletiontype:schedule', 'local_recompletion'),
]);
$mform->setDefault('recompletiontype', $config->recompletiontype ?? '');
$mform->setDefault('recompletiontype', RECOMPLETION_TYPE_DISABLED);
$mform->addHelpButton('recompletiontype', 'recompletiontype', 'local_recompletion');

$mform->addElement('checkbox', 'recompletionemailenable', get_string('recompletionemailenable', 'local_recompletion'));
Expand Down
1 change: 1 addition & 0 deletions classes/task/check_recompletion.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public function reset_user($userid, $course, $config = null) {
}
if (empty($config->recompletiontype)) {
$errors[] = get_string('recompletionnotenabledincourse', 'local_recompletion', $course->id);
return $errors;
}

$restrictions = local_recompletion_get_supported_restrictions();
Expand Down

0 comments on commit 9853042

Please sign in to comment.