Skip to content

Commit

Permalink
MDL-59666 mod_assign: Add validation for grading due date
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Aug 4, 2017
1 parent 6aaea76 commit 63b096c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mod/assign/lang/en/assign.php
Expand Up @@ -252,6 +252,8 @@
$string['gradingchangessaved'] = 'The grade changes were saved';
$string['gradingduedate'] = 'Remind me to grade by';
$string['gradingduedate_help'] = 'The expected date that marking of the submissions should be completed by. This date is used to prioritise dashboard notifications for teachers.';
$string['gradingdueduedatevalidation'] = 'Remind me to grade by date cannot be earlier than the due date.';
$string['gradingduefromdatevalidation'] = 'Remind me to grade by date cannot be earlier than the allow submissions from date.';
$string['gradechangessaveddetail'] = 'The changes to the grade and feedback were saved';
$string['gradingmethodpreview'] = 'Grading criteria';
$string['gradingoptions'] = 'Options';
Expand Down
8 changes: 8 additions & 0 deletions mod/assign/mod_form.php
Expand Up @@ -238,6 +238,14 @@ public function validation($data, $files) {
$errors['cutoffdate'] = get_string('cutoffdatefromdatevalidation', 'assign');
}
}
if ($data['gradingduedate']) {
if ($data['allowsubmissionsfromdate'] && $data['allowsubmissionsfromdate'] > $data['gradingduedate']) {
$errors['gradingduedate'] = get_string('gradingduefromdatevalidation', 'assign');
}
if ($data['duedate'] && $data['duedate'] > $data['gradingduedate']) {
$errors['gradingduedate'] = get_string('gradingdueduedatevalidation', 'assign');
}
}
if ($data['blindmarking'] && $data['attemptreopenmethod'] == ASSIGN_ATTEMPT_REOPEN_METHOD_UNTILPASS) {
$errors['attemptreopenmethod'] = get_string('reopenuntilpassincompatiblewithblindmarking', 'assign');
}
Expand Down

0 comments on commit 63b096c

Please sign in to comment.