Skip to content

Commit

Permalink
only sort visibleUsers
Browse files Browse the repository at this point in the history
  • Loading branch information
drdrew42 committed Feb 19, 2023
1 parent 0cb2413 commit 02b0895
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/WeBWorK/ContentGenerator/Instructor/UserList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ sub pre_header_initialize ($c) {
$c->{allUserIDs} = [ keys %allUsers ];
$c->{sortedUserIDs} = [
map { $_->user_id }
sort { &$primarySortSub || &$secondarySortSub || &$ternarySortSub } (values %allUsers)
sort { &$primarySortSub || &$secondarySortSub || &$ternarySortSub }
grep { $c->{visibleUserIDs}{ $_->user_id } } (values %allUsers)
];

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</tr>
</thead>
<tbody class="table-group-divider">
% for (grep { $c->{visibleUserIDs}{$_} } @{ $c->{sortedUserIDs} }) {
% for (@{ $c->{sortedUserIDs} }) {
<%= include 'ContentGenerator/Instructor/UserList/user_row',
user => $c->{allUsers}{$_}, userSelected => exists $c->{selectedUserIDs}{$_}, editable => exists $c->{userIsEditable}{$_} =%>
% }
Expand All @@ -78,7 +78,7 @@
</div>
%
% # If there are no users shown print message.
% unless (scalar(keys %{ $c->{visibleUserIDs} })) {
% unless (scalar(@{ $c->{sortedUserIDs} })) {
<p>
<i>
<%= maketext('No students shown. Choose one of the options above to list the students in the course.') =%>
Expand Down

0 comments on commit 02b0895

Please sign in to comment.