Skip to content

Commit

Permalink
Merge pull request openwebwork#1935 from drgrice1/bugfix/userlist-upd…
Browse files Browse the repository at this point in the history
…ate-on-save

Update user information in cached list when saving a user in the Classlist Editor.
  • Loading branch information
pstaabp authored Apr 7, 2023
2 parents 18441be + 161adc3 commit 8422801
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions lib/WeBWorK/ContentGenerator/Instructor/UserList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}{$_}
=%>
% }
</tbody>
Expand Down

0 comments on commit 8422801

Please sign in to comment.