Browse files

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.
  • Loading branch information...
1 parent 1f40540 commit 9deb25b78502deb7dceabf43980de1f1ae9370d1 @sammarshallou sammarshallou committed Apr 8, 2014
Showing with 5 additions and 0 deletions.
  1. +5 −0 course/moodleform_mod.php
@@ -688,6 +688,11 @@ function standard_coursemodule_elements(){
$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

0 comments on commit 9deb25b

Please sign in to comment.