mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'MDL-58278-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
ba1ad89e7d
3 changed files with 10 additions and 5 deletions
|
@ -78,11 +78,6 @@ class mod_assign_grade_form extends moodleform {
|
||||||
$errors = parent::validation($data, $files);
|
$errors = parent::validation($data, $files);
|
||||||
$instance = $this->assignment->get_instance();
|
$instance = $this->assignment->get_instance();
|
||||||
|
|
||||||
if ($instance->markingworkflow && !empty($data['sendstudentnotifications']) &&
|
|
||||||
$data['workflowstate'] != ASSIGN_MARKING_WORKFLOW_STATE_RELEASED) {
|
|
||||||
$errors['workflowstate'] = get_string('studentnotificationworkflowstateerror', 'assign');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Advanced grading.
|
// Advanced grading.
|
||||||
if (!array_key_exists('grade', $data)) {
|
if (!array_key_exists('grade', $data)) {
|
||||||
return $errors;
|
return $errors;
|
||||||
|
|
|
@ -7791,6 +7791,14 @@ class assign {
|
||||||
$feedbackmodified) {
|
$feedbackmodified) {
|
||||||
$this->update_grade($grade, !empty($formdata->addattempt));
|
$this->update_grade($grade, !empty($formdata->addattempt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We never send notifications if we have marking workflow and the grade is not released.
|
||||||
|
if ($this->get_instance()->markingworkflow &&
|
||||||
|
isset($formdata->workflowstate) &&
|
||||||
|
$formdata->workflowstate != ASSIGN_MARKING_WORKFLOW_STATE_RELEASED) {
|
||||||
|
$formdata->sendstudentnotifications = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Note the default if not provided for this option is true (e.g. webservices).
|
// Note the default if not provided for this option is true (e.g. webservices).
|
||||||
// This is for backwards compatibility.
|
// This is for backwards compatibility.
|
||||||
if (!isset($formdata->sendstudentnotifications) || $formdata->sendstudentnotifications) {
|
if (!isset($formdata->sendstudentnotifications) || $formdata->sendstudentnotifications) {
|
||||||
|
|
|
@ -1244,10 +1244,12 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
|
||||||
$data->grade = '50.0';
|
$data->grade = '50.0';
|
||||||
|
|
||||||
// This student will not receive notification.
|
// This student will not receive notification.
|
||||||
|
$data->sendstudentnotifications = 1;
|
||||||
$data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_READYFORRELEASE;
|
$data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_READYFORRELEASE;
|
||||||
$assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
|
$assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
|
||||||
|
|
||||||
// This student will receive notification.
|
// This student will receive notification.
|
||||||
|
$data->sendstudentnotifications = 1;
|
||||||
$data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_RELEASED;
|
$data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_RELEASED;
|
||||||
$assign->testable_apply_grade_to_user($data, $this->students[1]->id, 0);
|
$assign->testable_apply_grade_to_user($data, $this->students[1]->id, 0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue