mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-49673 mod_assign: Tidy up hidegrader patch
This commit is contained in:
parent
f14afd2936
commit
91a2215eea
@ -85,6 +85,7 @@ class backup_assign_activity_structure_step extends backup_activity_structure_st
|
||||
'requireallteammemberssubmit',
|
||||
'teamsubmissiongroupingid',
|
||||
'blindmarking',
|
||||
'hidegrader',
|
||||
'revealidentities',
|
||||
'attemptreopenmethod',
|
||||
'maxattempts',
|
||||
|
@ -175,10 +175,9 @@ function xmldb_assign_upgrade($oldversion) {
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2018120500) {
|
||||
// Define field hidegrader to be added to assign.
|
||||
// Define field hidegrader to be added to assign.
|
||||
$table = new xmldb_table('assign');
|
||||
$field = new xmldb_field('hidegrader', XMLDB_TYPE_INTEGER, '2', null,
|
||||
XMLDB_NOTNULL, null, '0', 'blindmarking');
|
||||
$field = new xmldb_field('hidegrader', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'blindmarking');
|
||||
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
|
@ -374,6 +374,7 @@ class mod_assign_external extends external_api {
|
||||
'm.requireallteammemberssubmit, '.
|
||||
'm.teamsubmissiongroupingid, ' .
|
||||
'm.blindmarking, ' .
|
||||
'm.hidegrader, ' .
|
||||
'm.revealidentities, ' .
|
||||
'm.attemptreopenmethod, '.
|
||||
'm.maxattempts, ' .
|
||||
@ -447,6 +448,7 @@ class mod_assign_external extends external_api {
|
||||
'requireallteammemberssubmit' => $module->requireallteammemberssubmit,
|
||||
'teamsubmissiongroupingid' => $module->teamsubmissiongroupingid,
|
||||
'blindmarking' => $module->blindmarking,
|
||||
'hidegrader' => $module->hidegrader,
|
||||
'revealidentities' => $module->revealidentities,
|
||||
'attemptreopenmethod' => $module->attemptreopenmethod,
|
||||
'maxattempts' => $module->maxattempts,
|
||||
@ -524,6 +526,7 @@ class mod_assign_external extends external_api {
|
||||
'requireallteammemberssubmit' => new external_value(PARAM_INT, 'if enabled, all team members must submit'),
|
||||
'teamsubmissiongroupingid' => new external_value(PARAM_INT, 'the grouping id for the team submission groups'),
|
||||
'blindmarking' => new external_value(PARAM_INT, 'if enabled, hide identities until reveal identities actioned'),
|
||||
'hidegrader' => new external_value(PARAM_INT, 'If enabled, hide grader to student'),
|
||||
'revealidentities' => new external_value(PARAM_INT, 'show identities for a blind marking assignment'),
|
||||
'attemptreopenmethod' => new external_value(PARAM_TEXT, 'method used to control opening new attempts'),
|
||||
'maxattempts' => new external_value(PARAM_INT, 'maximum number of attempts allowed'),
|
||||
@ -2362,6 +2365,9 @@ class mod_assign_external extends external_api {
|
||||
if ($gradingsummary) {
|
||||
$result['gradingsummary'] = $gradingsummary;
|
||||
}
|
||||
// Show the grader's identity if 'Hide Grader' is disabled or has the 'Show Hidden Grader' capability.
|
||||
$showgradername = (has_capability('mod/assign:showhiddengrader', $context, $user) or
|
||||
!$assign->is_hidden_grader());
|
||||
|
||||
// Did we submit anything?
|
||||
if ($lastattempt) {
|
||||
@ -2408,6 +2414,9 @@ class mod_assign_external extends external_api {
|
||||
// The feedback for our latest submission.
|
||||
if ($feedback) {
|
||||
if ($feedback->grade) {
|
||||
if (!$showgradername) {
|
||||
$feedback->grade->grader = false;
|
||||
}
|
||||
$feedbackplugins = $assign->get_feedback_plugins();
|
||||
$feedback->plugins = self::get_plugins_data($assign, $feedbackplugins, $feedback->grade);
|
||||
} else {
|
||||
@ -2446,7 +2455,12 @@ class mod_assign_external extends external_api {
|
||||
|
||||
if ($grade) {
|
||||
// From object to id.
|
||||
$grade->grader = $grade->grader->id;
|
||||
if (!$showgradername) {
|
||||
$grade->grader = false;
|
||||
} else {
|
||||
$grade->grader = $grade->grader->id;
|
||||
}
|
||||
|
||||
$feedbackplugins = self::get_plugins_data($assign, $previousattempts->feedbackplugins, $grade);
|
||||
|
||||
$attempt['grade'] = $grade;
|
||||
|
@ -2499,8 +2499,8 @@ class assign {
|
||||
if ($submission->hidegrader && !has_capability('mod/assign:showhiddengrader', $contextmodule, $user)) {
|
||||
$messagetype = 'feedbackavailableanon';
|
||||
// There's no point in having an "anonymous grader" if the notification email
|
||||
// comes from them. Send the email from the primary site admin instead.
|
||||
$grader = get_admin();
|
||||
// comes from them. Send the email from the noreply user instead.
|
||||
$grader = core_user::get_noreply_user();
|
||||
}
|
||||
|
||||
$eventtype = 'assign_notification';
|
||||
|
@ -199,7 +199,7 @@ class mod_assign_mod_form extends moodleform_mod {
|
||||
if ($assignment->has_submissions_or_grades() ) {
|
||||
$mform->freeze('blindmarking');
|
||||
}
|
||||
|
||||
|
||||
$name = get_string('hidegrader', 'assign');
|
||||
$mform->addElement('selectyesno', 'hidegrader', $name);
|
||||
$mform->addHelpButton('hidegrader', 'hidegrader', 'assign');
|
||||
|
@ -1,9 +1,9 @@
|
||||
@mod @mod_assign
|
||||
@mod @mod_assign @_file_upload
|
||||
Feature: Hide grader identities identity from students
|
||||
In order to keep the grader's identity a secret
|
||||
As a moodle teacher
|
||||
I need to enable Hide Grader in the assignment settings
|
||||
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
@ -40,7 +40,7 @@ Feature: Hide grader identities identity from students
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test assignment name"
|
||||
And I follow "View all submissions"
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And I should not see "Graded" in the "Student 1" "table_row"
|
||||
And I click on "Grade" "link" in the "Student 1" "table_row"
|
||||
And I set the field "Grade out of 100" to "50"
|
||||
@ -48,10 +48,10 @@ Feature: Hide grader identities identity from students
|
||||
And I press "Save changes"
|
||||
And I press "Ok"
|
||||
And I follow "Test assignment name"
|
||||
And I follow "View all submissions"
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And I should see "Graded" in the "Student 1" "table_row"
|
||||
And I log out
|
||||
|
||||
|
||||
@javascript
|
||||
Scenario: Hidden grading is disabled.
|
||||
When I log in as "student1"
|
||||
@ -61,14 +61,14 @@ Feature: Hide grader identities identity from students
|
||||
And I should see "Catch for us the foxes."
|
||||
And I should see "Teacher" in the "Graded by" "table_row"
|
||||
And I log out
|
||||
|
||||
|
||||
@javascript
|
||||
Scenario: Hidden grading is enabled.
|
||||
# Enable the hidden grader option
|
||||
When I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test assignment name"
|
||||
And I follow "Edit settings"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I follow "Expand all"
|
||||
And I set the field "Hide grader identity from students" to "1"
|
||||
And I press "Save and return to course"
|
||||
|
Loading…
x
Reference in New Issue
Block a user