Skip to content

Commit 057df45

Browse files
committed
Fix a minor issue resulting from #2935.
There is no longer a `pgwarning` key set on the controller object for the `lib/WeBWorK/ContentGenerator/Problem.pm` module and never was a `pgwarning` key for the returned pg object in the `lib/ContentGenerator/GatewayQuiz.pm` module. So use the correct key on the returned pg object in both cases. That is the `warning_messages` key. The warning messages were still being shown at the bottom, but not the message at the top of the page notifying of the existence of those warnings. Since the warnings at the bottom might not be visible, the warnings may be missed.
1 parent 983c1c6 commit 057df45

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/WeBWorK/ContentGenerator/GatewayQuiz.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ async sub getProblemHTML ($c, $effectiveUser, $set, $formFields, $mergedProblem)
15121512
if $c->{can}{checkAnswers}
15131513
&& (!$c->{submitAnswers} || defined $c->param('problem_data_' . $mergedProblem->problem_id));
15141514

1515-
$c->stash->{haveProblemWarnings} = 1 if $pg->{warnings} || @{ $pg->{pgwarning} // [] };
1515+
$c->stash->{haveProblemWarnings} = 1 if $pg->{warnings} || @{ $pg->{warning_messages} // [] };
15161516

15171517
return $pg;
15181518
}

templates/ContentGenerator/Problem.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
% stash->{footerWidthClass} = 'col-lg-10';
6666
%
6767
<%== $c->post_header_text =%>
68-
% if ($c->{pg}{warnings} || @{ $c->{pgwarning} // [] }) {
68+
% if ($c->{pg}{warnings} || @{ $c->{pg}{warning_messages} // [] }) {
6969
<div class="row g-0 mb-2">
7070
<div class="col-12 alert alert-danger m-0">
7171
<%== maketext('<strong>Warning</strong>: There may be something wrong with this question. '

0 commit comments

Comments
 (0)