MDL-70786 report_progress: respect fullname setting.

This commit is contained in:
Luca Bösch
2021-05-04 14:19:17 +02:00
parent 3de329785d
commit 8962bd76c3
2 changed files with 32 additions and 28 deletions
+5 -4
View File
@@ -360,13 +360,14 @@ if ($csv) {
foreach($progress as $user) {
// User name
if ($csv) {
print csv_quote(fullname($user));
print csv_quote(fullname($user, has_capability('moodle/site:viewfullnames', $context)));
foreach ($extrafields as $field) {
echo $sep . csv_quote($user->{$field});
}
} else {
print '<tr><th scope="row"><a href="'.$CFG->wwwroot.'/user/view.php?id='.
$user->id.'&amp;course='.$course->id.'">'.fullname($user).'</a></th>';
print '<tr><th scope="row"><a href="' . $CFG->wwwroot . '/user/view.php?id=' .
$user->id . '&amp;course=' . $course->id . '">' .
fullname($user, has_capability('moodle/site:viewfullnames', $context)) . '</a></th>';
foreach ($extrafields as $field) {
echo '<td>' . s($user->{$field}) . '</td>';
}
@@ -414,7 +415,7 @@ foreach($progress as $user) {
$a=new StdClass;
$a->state=$describe;
$a->date=$date;
$a->user=fullname($user);
$a->user = fullname($user, has_capability('moodle/site:viewfullnames', $context));
$a->activity = $formattedactivities[$activity->id]->displayname;
$fulldescribe=get_string('progress-title','completion',$a);
@@ -14,13 +14,16 @@ Feature: Teacher can view and override users' activity completion data via the p
| assign | my assignment 2 | A2 desc | C1 | assign2 | 0 | 2 | 1 | | 0 | 0 |
| assign | my assignment 3 | A3 desc | C1 | assign3 | 0 | 2 | 1 | 1 | 1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | One | teacher1@example.com |
| student1 | Student | One | student1@example.com |
| username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
| teacher1 | Teacher | One | teacher1@example.com | t1 | | fred | | |
| student1 | Grainne | Beauchamp | student1@example.com | s1 | Ann | Jill | Gronya | Beecham |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following config values are set as admin:
| fullnamedisplay | firstname |
| alternativefullnameformat | middlename, alternatename, firstname, lastname |
# Course comprising one activity with auto completion (student must view it) and one with manual completion.
# This confirms that after being completed by the student and overridden by the teacher, that both activities can still be
@@ -42,21 +45,21 @@ Feature: Teacher can view and override users' activity completion data via the p
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports > Activity completion" in current page administration
And "Student One, my assignment: Completed" "icon" should exist in the "Student One" "table_row"
And "Student One, my assignment 2: Completed" "icon" should exist in the "Student One" "table_row"
And I click on "my assignment" "link" in the "Student One" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "my assignment" "link" in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "Save changes" "button"
And "Student One, my assignment: Not completed (set by Teacher One)" "icon" should exist in the "Student One" "table_row"
And I click on "my assignment 2" "link" in the "Student One" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Not completed (set by Teacher)" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "my assignment 2" "link" in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "Save changes" "button"
And "Student One, my assignment 2: Not completed (set by Teacher One)" "icon" should exist in the "Student One" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Not completed (set by Teacher)" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I log out
# Student can now complete the activities again, via normal means.
Then I log in as "student1"
And I am on "Course 1" course homepage
And "Not completed: my assignment (set by Teacher One). Select to mark as complete." "icon" should exist in the "my assignment" "list_item"
And "Not completed: my assignment 2 (set by Teacher One)" "icon" should exist in the "my assignment 2" "list_item"
And I click on "Not completed: my assignment (set by Teacher One). Select to mark as complete." "icon"
And "Not completed: my assignment (set by Teacher). Select to mark as complete." "icon" should exist in the "my assignment" "list_item"
And "Not completed: my assignment 2 (set by Teacher)" "icon" should exist in the "my assignment 2" "list_item"
And I click on "Not completed: my assignment (set by Teacher). Select to mark as complete." "icon"
And "Completed: my assignment. Select to mark as not complete." "icon" should exist in the "my assignment" "list_item"
And I click on "my assignment 2" "link"
And I am on "Course 1" course homepage
@@ -66,8 +69,8 @@ Feature: Teacher can view and override users' activity completion data via the p
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports > Activity completion" in current page administration
And "Student One, my assignment: Completed" "icon" should exist in the "Student One" "table_row"
And "Student One, my assignment 2: Completed" "icon" should exist in the "Student One" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
# Course comprising one activity with auto completion (student must view it and receive a grade) and one with manual completion.
# This confirms that after being overridden to complete by the teacher, that the completion status for activities with automatic
@@ -78,19 +81,19 @@ Feature: Teacher can view and override users' activity completion data via the p
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports > Activity completion" in current page administration
And "Student One, my assignment: Not completed" "icon" should exist in the "Student One" "table_row"
And "Student One, my assignment 3: Not completed" "icon" should exist in the "Student One" "table_row"
And I click on "my assignment" "link" in the "Student One" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Not completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 3: Not completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "my assignment" "link" in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "Save changes" "button"
And "Student One, my assignment: Completed (set by Teacher One)" "icon" should exist in the "Student One" "table_row"
And I click on "my assignment 3" "link" in the "Student One" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment: Completed (set by Teacher)" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "my assignment 3" "link" in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I click on "Save changes" "button"
And "Student One, my assignment 3: Completed (set by Teacher One)" "icon" should exist in the "Student One" "table_row"
And "Ann, Jill, Grainne, Beauchamp, my assignment 3: Completed (set by Teacher)" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row"
And I log out
# Then as a student, confirm that automatic completion checks are no longer triggered (such as after an assign submission).
Then I log in as "student1"
And I am on "Course 1" course homepage
And "Completed: my assignment 3 (set by Teacher One)" "icon" should exist in the "my assignment 3" "list_item"
And "Completed: my assignment 3 (set by Teacher)" "icon" should exist in the "my assignment 3" "list_item"
And I click on "my assignment 3" "link"
And I press "Add submission"
And I set the following fields to these values:
@@ -98,10 +101,10 @@ Feature: Teacher can view and override users' activity completion data via the p
And I press "Save changes"
And I should see "Submitted for grading"
And I am on "Course 1" course homepage
And "Completed: my assignment 3 (set by Teacher One)" "icon" should exist in the "my assignment 3" "list_item"
And "Completed: my assignment 3 (set by Teacher)" "icon" should exist in the "my assignment 3" "list_item"
# And Confirm that manual completion changes are still allowed.
And I am on "Course 1" course homepage
And "Completed: my assignment (set by Teacher One). Select to mark as not complete." "icon" should exist in the "my assignment" "list_item"
And I click on "Completed: my assignment (set by Teacher One). Select to mark as not complete." "icon"
And "Completed: my assignment (set by Teacher). Select to mark as not complete." "icon" should exist in the "my assignment" "list_item"
And I click on "Completed: my assignment (set by Teacher). Select to mark as not complete." "icon"
And "Not completed: my assignment. Select to mark as complete." "icon" should exist in the "my assignment" "list_item"
And I log out