Skip to content

Commit

Permalink
Merge branch 'MDL-52838-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Nov 10, 2017
2 parents 6b2a9a6 + ce225e1 commit 6e2d8c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mod/workshop/form/rubric/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,13 @@ protected function validation_inner($data, $files) {
}

// Make sure the levels grades are unique within the criterion.
$atleastonelevel = false;
for ($j = 0; isset($data['levelid__idx_'.$i.'__idy_'.$j]); $j++) {
if (0 == strlen(trim($data['definition__idx_'.$i.'__idy_'.$j]))) {
// The level definition is empty and will not be saved.
continue;
}
$atleastonelevel = true;

$levelgrade = $data['grade__idx_'.$i.'__idy_'.$j];

Expand All @@ -143,6 +145,9 @@ protected function validation_inner($data, $files) {
$dimgrades[$levelgrade] = $j;
}
}
if (!$atleastonelevel) {
$errors['level__idx_'.$i.'__idy_0'] = get_string('mustdefinelevel', 'workshopform_rubric');
}
}

return $errors;
Expand Down
1 change: 1 addition & 0 deletions mod/workshop/form/rubric/lang/en/workshopform_rubric.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
$string['levelgroup'] = 'Level grade and definition';
$string['levels'] = 'Levels';
$string['mustbeunique'] = 'Level grades must be unique within a criterion';
$string['mustdefinelevel'] = 'At least one level is required';
$string['mustchooseone'] = 'You have to select one of these items';
$string['pluginname'] = 'Rubric';

0 comments on commit 6e2d8c1

Please sign in to comment.