Skip to content

Commit

Permalink
Don't show use reward button when achievements are enabled but achiev…
Browse files Browse the repository at this point in the history
…ement items are disabled.
  • Loading branch information
somiaj committed Feb 2, 2025
1 parent 828f455 commit ea3e2f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/WeBWorK/AchievementItems.pm
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ sub description ($self) { return $self->{description}; }
# is paired with its input form to use the item.
sub UserItems ($c, $userName, $set, $records) {
my $db = $c->db;
my $ce = $c->ce;

# Return unless achievement items are enabled.
return unless $ce->{achievementsEnabled} && $ce->{achievementItemsEnabled};

# When acting as another user, achievement items can be listed but not used.
return if $set && $userName ne $c->param('user');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% last unless $c->ce->{achievementsEnabled};
% last unless $ce->{achievementsEnabled} && $ce->{achievementItemsEnabled};
%
% my $achievementItems = $c->{achievementItems};
% if ($achievementItems && @$achievementItems) {
Expand Down

0 comments on commit ea3e2f0

Please sign in to comment.