scales should be (courseid, scale) unique, since it's already abused it's not possible to add a unique in db, so we add additional check in GUI. Duplicate scale, course causes mapping problems in backup/restore
This commit is contained in:
@@ -81,7 +81,17 @@ class edit_scale_form extends moodleform {
|
||||
|
||||
/// perform extra validation before submission
|
||||
function validation($data){
|
||||
|
||||
global $CFG;
|
||||
|
||||
$errors= array();
|
||||
|
||||
// we can not allow 2 scales with the same exact scale as this creates
|
||||
// problems for backup/restore
|
||||
$courseid = empty($data['courseid'])?0:$data['courseid'];
|
||||
if (count_records('scale', 'courseid', $courseid, 'scale', $data['scale'])) {
|
||||
$errors['scale'] = get_string('duplicatescale', 'grades');
|
||||
}
|
||||
|
||||
$options = explode(',', $data['scale']);
|
||||
if (count($options) < 2) {
|
||||
@@ -94,8 +104,6 @@ class edit_scale_form extends moodleform {
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -94,6 +94,7 @@ $string['droplow'] = 'Drop the lowest';
|
||||
$string['dropped'] = 'Dropped';
|
||||
$string['dropxlowest'] = 'Drop X Lowest';
|
||||
$string['dropxlowestwarning'] = 'Note: If you use drop x lowest the grading assumes that all items in the category have the same point value. If point values differ results will be unpredictable';
|
||||
$string['duplicatescale'] = 'Duplicate scale';
|
||||
$string['edit'] = 'Edit';
|
||||
$string['editcalculation'] = 'Edit Calculation';
|
||||
$string['editfeedback'] = 'Edit Feedback';
|
||||
|
||||
Reference in New Issue
Block a user