MDL-44268 assign: add 'not submitted' and 'no marker' filter options

This commit is contained in:
Jonathon Fowler 2014-02-18 16:46:51 +10:00 committed by Damyon Wiese
parent 3c72b71191
commit c80d59f269
5 changed files with 70 additions and 2 deletions

View File

@ -49,6 +49,7 @@ class mod_assign_grading_options_form extends moodleform {
$options = array(-1=>get_string('all'), 10=>'10', 20=>'20', 50=>'50', 100=>'100');
$mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options, $dirtyclass);
$options = array('' => get_string('filternone', 'assign'),
ASSIGN_FILTER_NOT_SUBMITTED => get_string('filternotsubmitted', 'assign'),
ASSIGN_FILTER_SUBMITTED => get_string('filtersubmitted', 'assign'),
ASSIGN_FILTER_REQUIRE_GRADING => get_string('filterrequiregrading', 'assign'));
if ($instance['submissionsenabled']) {

View File

@ -180,6 +180,9 @@ class assign_grading_table extends table_sql implements renderable {
s.status = :submitted) ';
$params['submitted'] = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
} else if ($filter == ASSIGN_FILTER_NOT_SUBMITTED) {
$where .= ' AND (s.timemodified IS NULL) ';
} else if ($filter == ASSIGN_FILTER_REQUIRE_GRADING) {
$where .= ' AND (s.timemodified IS NOT NULL AND
s.status = :submitted AND
@ -198,8 +201,12 @@ class assign_grading_table extends table_sql implements renderable {
// Check to see if marker filter is set.
$markerfilter = (int)get_user_preferences('assign_markerfilter', '');
if (!empty($markerfilter)) {
$where .= ' AND uf.allocatedmarker = :markerid';
$params['markerid'] = $markerfilter;
if ($markerfilter == ASSIGN_MARKER_FILTER_NO_MARKER) {
$where .= ' AND (uf.allocatedmarker IS NULL OR uf.allocatedmarker = 0)';
} else {
$where .= ' AND uf.allocatedmarker = :markerid';
$params['markerid'] = $markerfilter;
}
}
} else { // Only show users allocated to this marker.
$where .= ' AND uf.allocatedmarker = :markerid';

View File

@ -194,6 +194,7 @@ $string['feedbacksettings'] = 'Feedback settings';
$string['filesubmissions'] = 'File submissions';
$string['filter'] = 'Filter';
$string['filternone'] = 'No filter';
$string['filternotsubmitted'] = 'Not submitted';
$string['filterrequiregrading'] = 'Requires grading';
$string['filtersubmitted'] = 'Submitted';
$string['gradedby'] = 'Graded by';
@ -228,6 +229,7 @@ $string['manageassignfeedbackplugins'] = 'Manage assignment feedback plugins';
$string['manageassignsubmissionplugins'] = 'Manage assignment submission plugins';
$string['marker'] = 'Marker';
$string['markerfilter'] = 'Marker filter';
$string['markerfilternomarker'] = 'No marker';
$string['markingallocation'] = 'Use marking allocation';
$string['markingallocation_help'] = 'If enabled together with marking workflow, markers can be allocated to particular students.';
$string['markingworkflow'] = 'Use marking workflow';

View File

@ -33,9 +33,13 @@ define('ASSIGN_SUBMISSION_STATUS_SUBMITTED', 'submitted');
// Search filters for grading page.
define('ASSIGN_FILTER_SUBMITTED', 'submitted');
define('ASSIGN_FILTER_NOT_SUBMITTED', 'notsubmitted');
define('ASSIGN_FILTER_SINGLE_USER', 'singleuser');
define('ASSIGN_FILTER_REQUIRE_GRADING', 'require_grading');
// Marker filter for grading page.
define('ASSIGN_MARKER_FILTER_NO_MARKER', -1);
// Reopen attempt methods.
define('ASSIGN_ATTEMPT_REOPEN_METHOD_NONE', 'none');
define('ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL', 'manual');
@ -3044,6 +3048,7 @@ class assign {
if ($markingallocation) {
$markers = get_users_by_capability($this->context, 'mod/assign:grade');
$markingallocationoptions[''] = get_string('filternone', 'assign');
$markingallocationoptions[ASSIGN_MARKER_FILTER_NO_MARKER] = get_string('markerfilternomarker', 'assign');
foreach ($markers as $marker) {
$markingallocationoptions[$marker->id] = fullname($marker);
}
@ -5248,6 +5253,7 @@ class assign {
$markingallocationoptions = array();
if ($markingallocation) {
$markingallocationoptions[''] = get_string('filternone', 'assign');
$markingallocationoptions[ASSIGN_MARKER_FILTER_NO_MARKER] = get_string('markerfilternomarker', 'assign');
$markers = get_users_by_capability($this->context, 'mod/assign:grade');
foreach ($markers as $marker) {
$markingallocationoptions[$marker->id] = fullname($marker);

View File

@ -0,0 +1,52 @@
@mod @mod_assign
Feature: In an assignment, teachers can filter displayed submissions by assigned marker
In order to manage submissions more easily
As a teacher
I need to view submissions allocated to markers.
@javascript
Scenario: Allocate markers to submissions and filter by marker
Given the following "courses" exists:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exists:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
| marker1 | Marker | 1 | marker1@asd.com |
And the following "course enrolments" exists:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| marker1 | C1 | teacher |
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 | 1 |
| assignsubmission_file_enabled | 0 |
| Use marking workflow | Yes |
| Use marking allocation | Yes |
And I follow "Test assignment name"
And I follow "View/grade all submissions"
And I click on "Grade Student 1" "link" in the "Student 1" "table_row"
And I select "Marker 1" from "allocatedmarker"
And I click on "Save changes" "button"
And I log out
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View/grade all submissions"
And I select "Marker 1" from "markerfilter"
Then I should see "Student 1"
And I should not see "Student 2"
When I select "No marker" from "markerfilter"
Then I should not see "Student 1"
And I should see "Student 2"
When I select "No filter" from "markerfilter"
Then I should see "Student 1"
And I should see "Student 2"