diff --git a/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm b/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm index e557919b2c..a38c4a35c5 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm @@ -238,13 +238,17 @@ sub pre_header_initialize ($c) { my $secondarySortSub = SORT_SUBS()->{ $c->{secondarySortField} }; my $ternarySortSub = SORT_SUBS()->{ $c->{ternarySortField} }; - $c->{allUserIDs} = [ keys %allUsers ]; + $c->{allUserIDs} = [ keys %allUsers ]; + + # Always have a definite sort order in case the first three sorts don't determine things. $c->{sortedUserIDs} = [ map { $_->user_id } - sort { &$primarySortSub || &$secondarySortSub || &$ternarySortSub } + sort { &$primarySortSub || &$secondarySortSub || &$ternarySortSub || byLastName || byFirstName || byUserID } grep { $c->{visibleUserIDs}{ $_->user_id } } (values %allUsers) ]; + for (@{ $c->{sortedUserIDs} }) { $c->log->info($_); } + return; } @@ -511,6 +515,9 @@ sub save_edit_handler ($c) { $db->putUser($User); $db->putPermissionLevel($PermissionLevel); + + $User->{permission} = $PermissionLevel->permission; + $c->{allUsers}{$userID} = $User; } if (defined $c->param('prev_visible_users')) { diff --git a/templates/ContentGenerator/Instructor/UserList/user_list.html.ep b/templates/ContentGenerator/Instructor/UserList/user_list.html.ep index c42223351b..4c236d7d16 100644 --- a/templates/ContentGenerator/Instructor/UserList/user_list.html.ep +++ b/templates/ContentGenerator/Instructor/UserList/user_list.html.ep @@ -73,7 +73,7 @@ <%= include 'ContentGenerator/Instructor/UserList/user_row', user => $c->{allUsers}{$_}, userSelected => exists $c->{selectedUserIDs}{$_}, - editable => exists $c->{userIsEditable}{$_} + editable => exists $c->{userIsEditable}{$_} =%> % }