Skip to content

Commit

Permalink
MDL-50724 mod_assign: show issues with groups in grading table
Browse files Browse the repository at this point in the history
Where a user is in multiple or no groups show and group membership
is required show an appropriate error in the gradding table rather
than 'Default Group'
  • Loading branch information
andrewhancox committed Oct 12, 2015
1 parent 74fad2c commit ce449f6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
7 changes: 7 additions & 0 deletions mod/assign/gradingtable.php
Expand Up @@ -637,6 +637,13 @@ public function col_team(stdClass $row) {
$this->get_group_and_submission($row->id, $group, $submission, -1);
if ($group) {
return $group->name;
} else if ($this->assignment->get_instance()->preventsubmissionnotingroup) {
$usergroups = $this->assignment->get_all_groups($row->id);
if (count($usergroups) > 1) {
return get_string('multipleteamsgrader', 'assign');
} else {
return get_string('noteamgrader', 'assign');
}
}
return get_string('defaultteam', 'assign');
}
Expand Down
8 changes: 5 additions & 3 deletions mod/assign/lang/en/assign.php
Expand Up @@ -278,7 +278,8 @@
$string['modulename_link'] = 'mod/assignment/view';
$string['modulenameplural'] = 'Assignments';
$string['moreusers'] = '{$a} more...';
$string['multipleteams'] = 'You\'re a member of multiple groups, please contact your teacher.';
$string['multipleteams'] = 'Member of more than one group';
$string['multipleteamsgrader'] = 'Member of more than one group, so unable to make submissions.';
$string['mysubmission'] = 'My submission: ';
$string['newsubmissions'] = 'Assignments submitted';
$string['noattempt'] = 'No attempt';
Expand All @@ -290,7 +291,8 @@
$string['nosavebutnext'] = 'Next';
$string['nosubmission'] = 'Nothing has been submitted for this assignment';
$string['nosubmissionsacceptedafter'] = 'No submissions accepted after ';
$string['noteam'] = 'You\'re not a member of any group, please contact your teacher.';
$string['noteam'] = 'Not a member of any group';
$string['noteamgrader'] = 'Not a member of any group, so unable to make submissions.';
$string['notgraded'] = 'Not graded';
$string['notgradedyet'] = 'Not graded yet';
$string['notsubmittedyet'] = 'Not submitted yet';
Expand Down Expand Up @@ -435,7 +437,7 @@
$string['textinstructions'] = 'Assignment instructions';
$string['timemodified'] = 'Last modified';
$string['timeremaining'] = 'Time remaining';
$string['ungroupedusers'] = 'The setting \'Require group to make submission\' is turned on and some users are not allocated to groups or are allocated to multiple groups, this will prevent them from submitting assignments.';
$string['ungroupedusers'] = 'The setting \'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions.';
$string['unlocksubmissionforstudent'] = 'Allow submissions for student: (id={$a->id}, fullname={$a->fullname}).';
$string['unlocksubmissions'] = 'Unlock submissions';
$string['unlimitedattempts'] = 'Unlimited';
Expand Down
2 changes: 1 addition & 1 deletion mod/assign/locallib.php
Expand Up @@ -2323,7 +2323,7 @@ public function get_submission_group($userid) {
* @param int $userid Teh id of the user who's groups we are checking
* @return array The group objects
*/
protected function get_all_groups($userid) {
public function get_all_groups($userid) {
if (isset($this->usergroups[$userid])) {
return $this->usergroups[$userid];
}
Expand Down
24 changes: 13 additions & 11 deletions mod/assign/tests/behat/submit_without_group.feature
Expand Up @@ -47,7 +47,7 @@ Feature: Submit assignment without group
When I log in as "student1"
And I follow "Course 1"
And I follow "Allow default group"
Then I should not see "You're not a member of any group, please contact your teacher."
Then I should not see "Not a member of any group"
And I should see "Nothing has been submitted for this assignment"
And I press "Add submission"
And I set the following fields to these values:
Expand All @@ -58,13 +58,13 @@ Feature: Submit assignment without group
And I should see "Submitted for grading"
And I follow "Course 1"
And I follow "Require group membership"
And I should see "You're not a member of any group, please contact your teacher."
And I should see "Not a member of any group"
And I should see "Nothing has been submitted for this assignment"
And I should not see "Add submission"
And I am on homepage
And I follow "Course 2"
And I follow "Require group membership"
And I should not see "You're not a member of any group, please contact your teacher."
And I should not see "Not a member of any group"
And I should see "Nothing has been submitted for this assignment"
And I press "Add submission"
And I set the following fields to these values:
Expand All @@ -89,7 +89,7 @@ Feature: Submit assignment without group
And I follow "Course 1"
And I follow "Allow default group"
And I should see "1" in the "Groups" "table_row"
And I should not see "The setting 'Require group to make submission' is turned on and some users are not allocated to groups or are allocated to multiple groups, this will prevent them from submitting assignments."
And I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I follow "View/grade all submissions"
And I should see "Default group" in the "Student 1" "table_row"
And I should see "Default group" in the "Student 2" "table_row"
Expand All @@ -99,17 +99,17 @@ Feature: Submit assignment without group
And I follow "Course 1"
And I follow "Require group membership"
And I should see "0" in the "Groups" "table_row"
And I should see "The setting 'Require group to make submission' is turned on and some users are not allocated to groups or are allocated to multiple groups, this will prevent them from submitting assignments."
And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I follow "View/grade all submissions"
And I should see "Default group" in the "Student 1" "table_row"
And I should see "Default group" in the "Student 2" "table_row"
And I should see "Not a member of any group, so unable to make submissions." in the "Student 1" "table_row"
And I should see "Not a member of any group, so unable to make submissions." in the "Student 2" "table_row"
And I should not see "Submitted for grading" in the "Student 1" "table_row"
And I should not see "Submitted for grading" in the "Student 2" "table_row"
And I am on homepage
And I follow "Course 2"
And I follow "Require group membership"
And I should see "1" in the "Groups" "table_row"
And I should not see "The setting 'Require group to make submission' is turned on and some users are not allocated to groups or are allocated to multiple groups, this will prevent them from submitting assignments."
And I should not see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I follow "View/grade all submissions"
And I should see "Group 1" in the "Student 1" "table_row"
And I should see "Group 1" in the "Student 2" "table_row"
Expand All @@ -120,11 +120,13 @@ Feature: Submit assignment without group
And I log in as "student3"
And I follow "Course 3"
And I follow "Require group membership"
And I should see "You're a member of multiple groups, please contact your teacher."
And I should see "Member of more than one group"
And I should see "Nothing has been submitted for this assignment"
And I should not see "Add submission"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Course 3"
And I follow "Require group membership"
And I should see "The setting 'Require group to make submission' is turned on and some users are not allocated to groups or are allocated to multiple groups, this will prevent them from submitting assignments."
And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I follow "View/grade all submissions"
And I should see "Member of more than one group, so unable to make submissions." in the "Student 3" "table_row"

0 comments on commit ce449f6

Please sign in to comment.