From 30503a0c217e6235e09ca076aa9ddf63562c4575 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Tue, 8 Apr 2014 11:55:46 +0100 Subject: [PATCH] MDL-27459 Completion: When ratings off, disallow grade completion For activities that use ratings, there is no grade unless ratings are enabled. The completion system still lets you select 'complete when user gets a grade', which leads to later errors. This change simply disables the 'completion on grade' field if ratings are enabled for the activity, but not turned on in the form. --- course/moodleform_mod.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php index c563107ab6e..6f9a4b14c9f 100644 --- a/course/moodleform_mod.php +++ b/course/moodleform_mod.php @@ -666,6 +666,11 @@ abstract class moodleform_mod extends moodleform { $mform->disabledIf('completionusegrade', 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC); $mform->addHelpButton('completionusegrade', 'completionusegrade', 'completion'); $gotcompletionoptions = true; + + // If using the rating system, there is no grade unless ratings are enabled. + if ($this->_features->rating) { + $mform->disabledIf('completionusegrade', 'assessed', 'eq', 0); + } } // Automatic completion according to module-specific rules