Skip to content

Commit

Permalink
Merge branch '47684-28' of git://github.com/samhemelryk/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Oct 23, 2014
2 parents 25bd390 + d28e0a2 commit 9a3385c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions course/moodleform_mod.php
Expand Up @@ -291,6 +291,14 @@ function validation($data, $files) {
}
}

// Ratings: Don't let them select an aggregate type without selecting a scale.
// If the user has selected to use ratings but has not chosen a scale or set max points then the form is
// invalid. If ratings have been selected then the user must select either a scale or max points.
// This matches (horrible) logic in data_preprocessing.
if (isset($data['assessed']) && $data['assessed'] > 0 && empty($data['scale'])) {
$errors['assessed'] = get_string('scaleselectionrequired', 'rating');
}

// Completion: Don't let them choose automatic completion without turning
// on some conditions. Ignore this check when completion settings are
// locked, as the options are then disabled.
Expand Down
1 change: 1 addition & 0 deletions lang/en/rating.php
Expand Up @@ -55,3 +55,4 @@
$string['ratings'] = 'Ratings';
$string['rolewarning'] = 'Roles with permission to rate';
$string['rolewarning_help'] = 'To submit ratings users require the moodle/rating:rate capability and any module specific capabilities. Users assigned the following roles should be able to rate items. The list of roles may be amended via the permissions link in the administration block.';
$string['scaleselectionrequired'] = 'When selecting a ratings aggregate type you must also select to use either a scale or set a maximum points.';

0 comments on commit 9a3385c

Please sign in to comment.