Merge branch 'MDL-53024-35' of git://github.com/damyon/moodle into MOODLE_35_STABLE

This commit is contained in:
Andrew Nicols 2018-08-27 15:46:34 +08:00
commit 0dfef1313f
2 changed files with 72 additions and 18 deletions

View file

@ -155,25 +155,13 @@ class assign_grading_table extends table_sql implements renderable {
LEFT JOIN {assign_submission} s LEFT JOIN {assign_submission} s
ON u.id = s.userid ON u.id = s.userid
AND s.assignment = :assignmentid1 AND s.assignment = :assignmentid1
AND s.latest = 1 AND s.latest = 1 ';
LEFT JOIN {assign_grades} g
ON u.id = g.userid
AND g.assignment = :assignmentid2 ';
// For group submissions we don't immediately create an entry in the assign_submission table for each user, // For group assignments, there can be a grade with no submission.
// instead the userid is set to 0. In this case we use a different query to retrieve the grade for the user. $from .= ' LEFT JOIN {assign_grades} g
if ($this->assignment->get_instance()->teamsubmission) { ON g.assignment = :assignmentid2
$params['assignmentid4'] = (int) $this->assignment->get_instance()->id; AND u.id = g.userid
$grademaxattempt = 'SELECT mxg.userid, MAX(mxg.attemptnumber) AS maxattempt AND (g.attemptnumber = s.attemptnumber OR s.attemptnumber IS NULL) ';
FROM {assign_grades} mxg
WHERE mxg.assignment = :assignmentid4
GROUP BY mxg.userid';
$from .= 'LEFT JOIN (' . $grademaxattempt . ') gmx
ON u.id = gmx.userid
AND g.attemptnumber = gmx.maxattempt ';
} else {
$from .= 'AND g.attemptnumber = s.attemptnumber ';
}
$from .= 'LEFT JOIN {assign_user_flags} uf $from .= 'LEFT JOIN {assign_user_flags} uf
ON u.id = uf.userid ON u.id = uf.userid

View file

@ -134,6 +134,72 @@ Feature: Group assignment submissions
And "Student 3" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 3" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 4" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 4" row "Status" column of "generaltable" table should contain "Submitted for grading"
@javascript
Scenario: Confirm that group submissions can be reopened
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 |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
| student4 | Student | 4 | student4@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Attempts reopened | Manually |
| Group mode | No groups |
| Require group to make submission | No |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
| Grade out of 100 | 50.0 |
| Apply grades and feedback to entire group | 1 |
And I press "Save changes"
And I press "Ok"
And I set the following fields to these values:
| Allow another attempt | 1 |
And I press "Save changes"
And I press "Ok"
When I am on "Course 1" course homepage
And I follow "Test assignment name"
And I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Reopened"
And "Student 2" row "Status" column of "generaltable" table should contain "Reopened"
Scenario: Confirm groups and submission counts are correct Scenario: Confirm groups and submission counts are correct
Given the following "courses" exist: Given the following "courses" exist:
| fullname | shortname | category | groupmode | | fullname | shortname | category | groupmode |