diff --git a/lib/WeBWorK/AchievementItems.pm b/lib/WeBWorK/AchievementItems.pm index 71086e3e95..a9ad736516 100644 --- a/lib/WeBWorK/AchievementItems.pm +++ b/lib/WeBWorK/AchievementItems.pm @@ -59,9 +59,6 @@ sub UserItems ($c, $userName, $set, $records) { # 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'); - # Return unless the user has global achievement data. my $globalUserAchievement = $c->{globalData} // $db->getGlobalUserAchievement($userName); return unless $globalUserAchievement && $globalUserAchievement->frozen_hash; @@ -70,6 +67,9 @@ sub UserItems ($c, $userName, $set, $records) { my $use_item_id = $c->param('use_achievement_item_id') // ''; my @items; + # When acting as another user, achievement items can be listed but not used. + $use_item_id = '' if $userName ne $c->param('user'); + for my $item (@{ +ITEMS }) { next unless $globalData->{$item}; my $achievementItem = "WeBWorK::AchievementItems::$item"->new; diff --git a/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep b/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep index 3fdbfcf5d6..0b81b30b71 100644 --- a/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep +++ b/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep @@ -34,6 +34,7 @@ % my ($item, $form) = @$_;
<%= $item->name %>
+ % if (param('user') eq param('effectiveUser')) { <%= form_for current_route, method => 'POST', name => 'use_reward', begin =%> <%= hidden_field 'use_achievement_item_id' => $item->id %> <%= $form %> @@ -43,6 +44,17 @@ value="<%= maketext('Use [_1]', $item->remaining_title($c)) %>"> % } <%= end =%> + % } else { + <%= $form %> + + + + % }
% } @@ -53,13 +65,6 @@ - % } elsif (param('user') ne param('effectiveUser')) { - - - % } else {