diff --git a/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm b/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm index 092a7a4f90..c45488af7e 100644 --- a/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm +++ b/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm @@ -847,6 +847,11 @@ async sub pre_header_initialize ($c) { push(@pg_results, $pg); } + # Show the template problem ID if the problems are in random order + # or the template problem IDs are not in order starting at 1. + $c->{can}{showTemplateIds} = $c->{can}{showProblemGrader} + && ($set->problem_randorder || $problems[-1]->problem_id != scalar(@problems)); + # Wait for all problems to be rendered and replace the undefined entries # in the pg_results array with the rendered result. my @renderedPG = await Mojo::Promise->all(@renderPromises); diff --git a/templates/ContentGenerator/GatewayQuiz.html.ep b/templates/ContentGenerator/GatewayQuiz.html.ep index 0934437597..123691f58d 100644 --- a/templates/ContentGenerator/GatewayQuiz.html.ep +++ b/templates/ContentGenerator/GatewayQuiz.html.ep @@ -522,6 +522,10 @@ % # Output the problem header.

<%= maketext('Problem [_1].', $i + 1) %>

+ % if ($c->{can}{showTemplateIds}) { + <%= '(' + . maketext('Template ID: [_1]', $problems->[ $probOrder->[$i] ]->problem_id) . ')' %> + % } % my $problemValue = $problems->[ $probOrder->[$i] ]->value; % if (defined $problemValue) { % my $points = $problemValue == 1 ? maketext('point') : maketext('points');