Merge branch 'master-MDL-69631-v3' of https://github.com/golenkovm/moodle

This commit is contained in:
Adrian Greeve 2021-01-25 08:15:36 +08:00
commit 7e0c33b376
6 changed files with 78 additions and 2 deletions

View File

@ -59,6 +59,7 @@ class mod_assign_grading_options_form extends moodleform {
$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_DRAFT => get_string('filterdraft', 'assign'),
ASSIGN_FILTER_SUBMITTED => get_string('filtersubmitted', 'assign'),
ASSIGN_FILTER_REQUIRE_GRADING => get_string('filterrequiregrading', 'assign'),
ASSIGN_FILTER_GRANTED_EXTENSION => get_string('filtergrantedextension', 'assign'));

View File

@ -327,6 +327,10 @@ class assign_grading_table extends table_sql implements renderable {
$userfilter = (int) array_pop(explode('=', $filter));
$where .= ' AND (u.id = :userid)';
$params['userid'] = $userfilter;
} else if ($filter == ASSIGN_FILTER_DRAFT) {
$where .= ' AND (s.timemodified IS NOT NULL AND
s.status = :draft) ';
$params['draft'] = ASSIGN_SUBMISSION_STATUS_DRAFT;
}
}

View File

@ -259,6 +259,7 @@ $string['feedbacksettings'] = 'Feedback settings';
$string['feedbacktypes'] = 'Feedback types';
$string['filesubmissions'] = 'File submissions';
$string['filter'] = 'Filter';
$string['filterdraft'] = 'Draft';
$string['filtergrantedextension'] = 'Granted extension';
$string['filternone'] = 'No filter';
$string['filternotsubmitted'] = 'Not submitted';

View File

@ -39,6 +39,7 @@ define('ASSIGN_FILTER_NOT_SUBMITTED', 'notsubmitted');
define('ASSIGN_FILTER_SINGLE_USER', 'singleuser');
define('ASSIGN_FILTER_REQUIRE_GRADING', 'requiregrading');
define('ASSIGN_FILTER_GRANTED_EXTENSION', 'grantedextension');
define('ASSIGN_FILTER_DRAFT', 'draft');
// Marker filter for grading page.
define('ASSIGN_MARKER_FILTER_NO_MARKER', -1);
@ -9346,8 +9347,9 @@ class assign {
*/
public function get_filters() {
$filterkeys = [
ASSIGN_FILTER_SUBMITTED,
ASSIGN_FILTER_NOT_SUBMITTED,
ASSIGN_FILTER_DRAFT,
ASSIGN_FILTER_SUBMITTED,
ASSIGN_FILTER_REQUIRE_GRADING,
ASSIGN_FILTER_GRANTED_EXTENSION
];

View File

@ -0,0 +1,68 @@
@mod @mod_assign
Feature: In an assignment, teachers can filter displayed submissions and see drafts
In order to manage submissions more easily
As a teacher
I need to view submissions with draft status.
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | assignsubmission_onlinetext_enabled | submissiondrafts |
| assign | C1 | assign1 | Test assignment | 1 | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I press "Add submission"
And I set the following fields to these values:
| Online text | This submission is submitted |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I press "Add submission"
And I set the following fields to these values:
| Online text | This submission is NOT submitted |
And I press "Save changes"
And I log out
@javascript
Scenario: View assignments with draft status on the view all submissions page
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I navigate to "View all submissions" in current page administration
When I set the field "Filter" to "Draft"
Then I should see "Student 2"
And I should not see "Student 1"
And I should not see "Student 3"
@javascript
Scenario: View assignments with draft status in the grader
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
When I click on "[data-region=user-filters]" "css_element"
And I set the field "filter" to "Draft"
Then I should see "1 of 1"
And I should see "Student 2"
And I should not see "Student 1"
And I should not see "Student 3"

View File

@ -3988,7 +3988,7 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
$assign = $this->create_instance($course);
$valid = $assign->get_filters();
$this->assertEquals(count($valid), 5);
$this->assertEquals(count($valid), 6);
}
/**