mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-49673 mod_assign: option to hide grader
This commit is contained in:
parent
33a388eff7
commit
f14afd2936
9 changed files with 189 additions and 3 deletions
|
@ -188,5 +188,15 @@ $capabilities = array(
|
||||||
'manager' => CAP_ALLOW
|
'manager' => CAP_ALLOW
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'mod/assign:showhiddengrader' => array(
|
||||||
|
'captype' => 'read',
|
||||||
|
'contextlevel' => CONTEXT_MODULE,
|
||||||
|
'archetypes' => array(
|
||||||
|
'teacher' => CAP_ALLOW,
|
||||||
|
'editingteacher' => CAP_ALLOW,
|
||||||
|
'manager' => CAP_ALLOW
|
||||||
|
)
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
<FIELD NAME="requireallteammemberssubmit" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If enabled, a submission will not be accepted until all team members have submitted it."/>
|
<FIELD NAME="requireallteammemberssubmit" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If enabled, a submission will not be accepted until all team members have submitted it."/>
|
||||||
<FIELD NAME="teamsubmissiongroupingid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="A grouping id to get groups for team submissions"/>
|
<FIELD NAME="teamsubmissiongroupingid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="A grouping id to get groups for team submissions"/>
|
||||||
<FIELD NAME="blindmarking" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Hide student/grader identities until the reveal identities action is performed"/>
|
<FIELD NAME="blindmarking" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Hide student/grader identities until the reveal identities action is performed"/>
|
||||||
|
<FIELD NAME="hidegrader" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Hide the grader's identity from students. The opposite of blind marking."/>
|
||||||
<FIELD NAME="revealidentities" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Show identities for a blind marking assignment"/>
|
<FIELD NAME="revealidentities" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Show identities for a blind marking assignment"/>
|
||||||
<FIELD NAME="attemptreopenmethod" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="none" SEQUENCE="false" COMMENT="How to determine when students are allowed to open a new submission. Valid options are none, manual, untilpass"/>
|
<FIELD NAME="attemptreopenmethod" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="none" SEQUENCE="false" COMMENT="How to determine when students are allowed to open a new submission. Valid options are none, manual, untilpass"/>
|
||||||
<FIELD NAME="maxattempts" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="-1" SEQUENCE="false" COMMENT="What is the maximum number of student attempts allowed for this assignment? -1 means unlimited."/>
|
<FIELD NAME="maxattempts" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="-1" SEQUENCE="false" COMMENT="What is the maximum number of student attempts allowed for this assignment? -1 means unlimited."/>
|
||||||
|
|
|
@ -174,5 +174,19 @@ function xmldb_assign_upgrade($oldversion) {
|
||||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||||
// Put any upgrade step following this.
|
// Put any upgrade step following this.
|
||||||
|
|
||||||
|
if ($oldversion < 2018120500) {
|
||||||
|
// 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');
|
||||||
|
|
||||||
|
if (!$dbman->field_exists($table, $field)) {
|
||||||
|
$dbman->add_field($table, $field);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assignment savepoint reached.
|
||||||
|
upgrade_mod_savepoint(true, 2018120500, 'assign');
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ $string['assign:revealidentities'] = 'Reveal student identities';
|
||||||
$string['assign:reviewgrades'] = 'Review grades';
|
$string['assign:reviewgrades'] = 'Review grades';
|
||||||
$string['assign:viewblinddetails'] = 'View student identities when blind marking is enabled';
|
$string['assign:viewblinddetails'] = 'View student identities when blind marking is enabled';
|
||||||
$string['assign:viewgrades'] = 'View grades';
|
$string['assign:viewgrades'] = 'View grades';
|
||||||
|
$string['assign:showhiddengrader'] = 'See the identity of a hidden grader';
|
||||||
$string['assign:submit'] = 'Submit assignment';
|
$string['assign:submit'] = 'Submit assignment';
|
||||||
$string['assign:view'] = 'View assignment';
|
$string['assign:view'] = 'View assignment';
|
||||||
$string['assignfeedback'] = 'Feedback plugin';
|
$string['assignfeedback'] = 'Feedback plugin';
|
||||||
|
@ -232,6 +233,16 @@ $string['feedbackavailablehtml'] = '{$a->username} has posted some feedback on y
|
||||||
assignment submission for \'<i>{$a->assignment}</i>\'<br /><br />
|
assignment submission for \'<i>{$a->assignment}</i>\'<br /><br />
|
||||||
You can see it appended to your <a href="{$a->url}">assignment submission</a>.';
|
You can see it appended to your <a href="{$a->url}">assignment submission</a>.';
|
||||||
$string['feedbackavailablesmall'] = '{$a->username} has given feedback for assignment {$a->assignment}';
|
$string['feedbackavailablesmall'] = '{$a->username} has given feedback for assignment {$a->assignment}';
|
||||||
|
$string['feedbackavailableanontext'] = 'You have new feedback on your
|
||||||
|
assignment submission for \'{$a->assignment}\'
|
||||||
|
|
||||||
|
You can see it appended to your assignment submission:
|
||||||
|
|
||||||
|
{$a->url}';
|
||||||
|
$string['feedbackavailableanonhtml'] = 'You have new feedback on your
|
||||||
|
assignment submission for \'<i>{$a->assignment}</i>\'<br /><br />
|
||||||
|
You can see it appended to your <a href="{$a->url}">assignment submission</a>.';
|
||||||
|
$string['feedbackavailableanonsmall'] = 'New feedback for assignment {$a->assignment}';
|
||||||
$string['feedbackplugins'] = 'Feedback plugins';
|
$string['feedbackplugins'] = 'Feedback plugins';
|
||||||
$string['feedbackpluginforgradebook'] = 'Feedback plugin that will push comments to the gradebook';
|
$string['feedbackpluginforgradebook'] = 'Feedback plugin that will push comments to the gradebook';
|
||||||
$string['feedbackpluginforgradebook_help'] = 'Only one assignment feedback plugin can push feedback into the gradebook.';
|
$string['feedbackpluginforgradebook_help'] = 'Only one assignment feedback plugin can push feedback into the gradebook.';
|
||||||
|
@ -271,6 +282,8 @@ $string['gradingsummary'] = 'Grading summary';
|
||||||
$string['groupoverrides'] = 'Group overrides';
|
$string['groupoverrides'] = 'Group overrides';
|
||||||
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
||||||
$string['groupsnone'] = 'There are no groups in this course';
|
$string['groupsnone'] = 'There are no groups in this course';
|
||||||
|
$string['hidegrader'] = 'Hide grader identity from students';
|
||||||
|
$string['hidegrader_help'] = 'Hides the identity of any user who grades an assignment submission, so students can\'t see who marked their work.';
|
||||||
$string['hideshow'] = 'Hide/Show';
|
$string['hideshow'] = 'Hide/Show';
|
||||||
$string['hiddenuser'] = 'Participant ';
|
$string['hiddenuser'] = 'Participant ';
|
||||||
$string['inactiveoverridehelp'] = '* Student does not have the correct group or role to attempt the assignment';
|
$string['inactiveoverridehelp'] = '* Student does not have the correct group or role to attempt the assignment';
|
||||||
|
|
|
@ -337,6 +337,18 @@ class assign {
|
||||||
return $this->get_instance()->blindmarking && !$this->get_instance()->revealidentities;
|
return $this->get_instance()->blindmarking && !$this->get_instance()->revealidentities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is hidden grading enabled?
|
||||||
|
*
|
||||||
|
* This just checks the assignment settings. Remember to check
|
||||||
|
* the user has the 'showhiddengrader' capability too
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_hidden_grader() {
|
||||||
|
return $this->get_instance()->hidegrader;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does an assignment have submission(s) or grade(s) already?
|
* Does an assignment have submission(s) or grade(s) already?
|
||||||
*
|
*
|
||||||
|
@ -664,6 +676,9 @@ class assign {
|
||||||
$update->teamsubmissiongroupingid = $formdata->teamsubmissiongroupingid;
|
$update->teamsubmissiongroupingid = $formdata->teamsubmissiongroupingid;
|
||||||
}
|
}
|
||||||
$update->blindmarking = $formdata->blindmarking;
|
$update->blindmarking = $formdata->blindmarking;
|
||||||
|
if (isset($formdata->hidegrader)) {
|
||||||
|
$update->hidegrader = $formdata->hidegrader;
|
||||||
|
}
|
||||||
$update->attemptreopenmethod = ASSIGN_ATTEMPT_REOPEN_METHOD_NONE;
|
$update->attemptreopenmethod = ASSIGN_ATTEMPT_REOPEN_METHOD_NONE;
|
||||||
if (!empty($formdata->attemptreopenmethod)) {
|
if (!empty($formdata->attemptreopenmethod)) {
|
||||||
$update->attemptreopenmethod = $formdata->attemptreopenmethod;
|
$update->attemptreopenmethod = $formdata->attemptreopenmethod;
|
||||||
|
@ -1403,6 +1418,9 @@ class assign {
|
||||||
if (isset($formdata->teamsubmissiongroupingid)) {
|
if (isset($formdata->teamsubmissiongroupingid)) {
|
||||||
$update->teamsubmissiongroupingid = $formdata->teamsubmissiongroupingid;
|
$update->teamsubmissiongroupingid = $formdata->teamsubmissiongroupingid;
|
||||||
}
|
}
|
||||||
|
if (isset($formdata->hidegrader)) {
|
||||||
|
$update->hidegrader = $formdata->hidegrader;
|
||||||
|
}
|
||||||
$update->blindmarking = $formdata->blindmarking;
|
$update->blindmarking = $formdata->blindmarking;
|
||||||
$update->attemptreopenmethod = ASSIGN_ATTEMPT_REOPEN_METHOD_NONE;
|
$update->attemptreopenmethod = ASSIGN_ATTEMPT_REOPEN_METHOD_NONE;
|
||||||
if (!empty($formdata->attemptreopenmethod)) {
|
if (!empty($formdata->attemptreopenmethod)) {
|
||||||
|
@ -2374,7 +2392,7 @@ class assign {
|
||||||
// - The grader was a real user, not an automated process.
|
// - The grader was a real user, not an automated process.
|
||||||
// - If marking workflow is not enabled, the grade was updated in the past 24 hours, or
|
// - If marking workflow is not enabled, the grade was updated in the past 24 hours, or
|
||||||
// if marking workflow is enabled, the workflow state is at 'released'.
|
// if marking workflow is enabled, the workflow state is at 'released'.
|
||||||
$sql = "SELECT g.id as gradeid, a.course, a.name, a.blindmarking, a.revealidentities,
|
$sql = "SELECT g.id as gradeid, a.course, a.name, a.blindmarking, a.revealidentities, a.hidegrader,
|
||||||
g.*, g.timemodified as lastmodified, cm.id as cmid, um.id as recordid
|
g.*, g.timemodified as lastmodified, cm.id as cmid, um.id as recordid
|
||||||
FROM {assign} a
|
FROM {assign} a
|
||||||
JOIN {assign_grades} g ON g.assignment = a.id
|
JOIN {assign_grades} g ON g.assignment = a.id
|
||||||
|
@ -2474,8 +2492,17 @@ class assign {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to send this to the student.
|
// Notify the student. Default to the non-anon version.
|
||||||
$messagetype = 'feedbackavailable';
|
$messagetype = 'feedbackavailable';
|
||||||
|
// Message type needs 'anon' if "hidden grading" is enabled and the student
|
||||||
|
// doesn't have permission to see the grader.
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
$eventtype = 'assign_notification';
|
$eventtype = 'assign_notification';
|
||||||
$updatetime = $submission->lastmodified;
|
$updatetime = $submission->lastmodified;
|
||||||
$modulename = get_string('modulename', 'assign');
|
$modulename = get_string('modulename', 'assign');
|
||||||
|
@ -5120,6 +5147,17 @@ class assign {
|
||||||
$this->get_return_action(),
|
$this->get_return_action(),
|
||||||
$this->get_return_params(),
|
$this->get_return_params(),
|
||||||
$viewfullnames);
|
$viewfullnames);
|
||||||
|
|
||||||
|
// Show the grader's identity if 'Hide Grader' is disabled or has the 'Show Hidden Grader' capability.
|
||||||
|
$showgradername = (
|
||||||
|
has_capability('mod/assign:showhiddengrader', $this->context, $user) or
|
||||||
|
!$this->is_hidden_grader()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$showgradername) {
|
||||||
|
$feedbackstatus->grader = false;
|
||||||
|
}
|
||||||
|
|
||||||
return $feedbackstatus;
|
return $feedbackstatus;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -200,6 +200,10 @@ class mod_assign_mod_form extends moodleform_mod {
|
||||||
$mform->freeze('blindmarking');
|
$mform->freeze('blindmarking');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$name = get_string('hidegrader', 'assign');
|
||||||
|
$mform->addElement('selectyesno', 'hidegrader', $name);
|
||||||
|
$mform->addHelpButton('hidegrader', 'hidegrader', 'assign');
|
||||||
|
|
||||||
$name = get_string('markingworkflow', 'assign');
|
$name = get_string('markingworkflow', 'assign');
|
||||||
$mform->addElement('selectyesno', 'markingworkflow', $name);
|
$mform->addElement('selectyesno', 'markingworkflow', $name);
|
||||||
$mform->addHelpButton('markingworkflow', 'markingworkflow', 'assign');
|
$mform->addHelpButton('markingworkflow', 'markingworkflow', 'assign');
|
||||||
|
|
|
@ -270,6 +270,16 @@ if ($ADMIN->fulltree) {
|
||||||
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
|
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
|
||||||
$settings->add($setting);
|
$settings->add($setting);
|
||||||
|
|
||||||
|
$name = new lang_string('hidegrader', 'mod_assign');
|
||||||
|
$description = new lang_string('hidegrader_help', 'mod_assign');
|
||||||
|
$setting = new admin_setting_configcheckbox('assign/hidegrader',
|
||||||
|
$name,
|
||||||
|
$description,
|
||||||
|
0);
|
||||||
|
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
|
||||||
|
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
|
||||||
|
$settings->add($setting);
|
||||||
|
|
||||||
$name = new lang_string('markingworkflow', 'mod_assign');
|
$name = new lang_string('markingworkflow', 'mod_assign');
|
||||||
$description = new lang_string('markingworkflow_help', 'mod_assign');
|
$description = new lang_string('markingworkflow_help', 'mod_assign');
|
||||||
$setting = new admin_setting_configcheckbox('assign/markingworkflow',
|
$setting = new admin_setting_configcheckbox('assign/markingworkflow',
|
||||||
|
|
96
mod/assign/tests/behat/hide_grader.feature
Normal file
96
mod/assign/tests/behat/hide_grader.feature
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
@mod @mod_assign
|
||||||
|
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 |
|
||||||
|
| Course 1 | C1 | 0 | 1 |
|
||||||
|
And the following "users" exist:
|
||||||
|
| username | firstname | lastname | email |
|
||||||
|
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||||
|
| student1 | Student | 1 | student1@example.com |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| teacher1 | C1 | editingteacher |
|
||||||
|
| student1 | C1 | student |
|
||||||
|
# Set up the test assignment
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add a "Assignment" to section "1" and I fill the form with:
|
||||||
|
| Assignment name | Test assignment name |
|
||||||
|
| Description | Submit your online text |
|
||||||
|
| assignsubmission_onlinetext_enabled | 0 |
|
||||||
|
| assignsubmission_file_enabled | 1 |
|
||||||
|
| Maximum number of uploaded files | 2 |
|
||||||
|
| Hide grader identity from students | 0 |
|
||||||
|
And I log out
|
||||||
|
# Upload to the test assignment
|
||||||
|
And I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Test assignment name"
|
||||||
|
When I press "Add submission"
|
||||||
|
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
|
||||||
|
And I press "Save changes"
|
||||||
|
And I log out
|
||||||
|
# Grade the submission and leave feedback
|
||||||
|
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 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"
|
||||||
|
And I set the field "Feedback comments" to "Catch for us the foxes."
|
||||||
|
And I press "Save changes"
|
||||||
|
And I press "Ok"
|
||||||
|
And I follow "Test assignment name"
|
||||||
|
And I follow "View all submissions"
|
||||||
|
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"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Test assignment name"
|
||||||
|
And I should see "Graded" in the "Grading status" "table_row"
|
||||||
|
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 follow "Expand all"
|
||||||
|
And I set the field "Hide grader identity from students" to "1"
|
||||||
|
And I press "Save and return to course"
|
||||||
|
And I log out
|
||||||
|
# Check the student doesn't see the grader's identity
|
||||||
|
And I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Test assignment name"
|
||||||
|
And I should see "Graded" in the "Grading status" "table_row"
|
||||||
|
And I should see "Catch for us the foxes."
|
||||||
|
And I should not see "Graded by"
|
||||||
|
And I log out
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Hidden grading is enabled, but students have the 'view' capability.
|
||||||
|
Given the following "permission overrides" exist:
|
||||||
|
| capability | permission | role | contextlevel | reference |
|
||||||
|
| mod/assign:showhiddengrader | Allow | student | Course | C1 |
|
||||||
|
When I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I follow "Test assignment name"
|
||||||
|
And I should see "Graded" in the "Grading status" "table_row"
|
||||||
|
And I should see "Catch for us the foxes."
|
||||||
|
And I should see "Teacher" in the "Graded by" "table_row"
|
||||||
|
And I log out
|
|
@ -25,6 +25,6 @@
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||||
$plugin->version = 2018120300; // The current module version (Date: YYYYMMDDXX).
|
$plugin->version = 2018120500; // The current module version (Date: YYYYMMDDXX).
|
||||||
$plugin->requires = 2018112800; // Requires this Moodle version.
|
$plugin->requires = 2018112800; // Requires this Moodle version.
|
||||||
$plugin->cron = 60;
|
$plugin->cron = 60;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue