Skip to content

Commit

Permalink
Fix issue with hidden input probstatusX in gateway quizzes.
Browse files Browse the repository at this point in the history
  The number `X` in the hidden input `probstatusX` needs to be the
  problem ID, but was being set to the index + 1 of the array used
  to randomized the problems.  This causes the single problem grader
  javascript to hit an error if a test's problems do not start at
  1 and are not in sequential order, as mentioned in openwebwork#2215.

  Also, since GatewayQuiz.pm assumes the X is the problem ID, and uses
  this hidden input to get the status of its problems when moving though
  different pages, a quiz whose problems don't start with 1 or are not
  in sequential error could retrieve an incorrect status as a result.

  This update fixes the issue by setting X equal to the problemID.
  • Loading branch information
somiaj committed Sep 25, 2023
1 parent e7fb7c4 commit fe0e06a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions templates/ContentGenerator/GatewayQuiz.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@
% }
</div>
% # Store the problem status for continued attempts recording.
<%= hidden_field 'probstatus' . ($probOrder->[$i] + 1) => $c->{probStatus}[ $probOrder->[$i] ] =%>
<%= hidden_field 'probstatus' . ($problems->[ $probOrder->[$i] ]{problem_id})
=> $c->{probStatus}[ $probOrder->[$i] ] =%>
%
<div class="gwDivider"></div>
% } else {
Expand All @@ -605,7 +606,8 @@
% }
% }
% # Store the problem status for continued attempts recording.
<%= hidden_field 'probstatus' . ($probOrder->[$i] + 1) => $c->{probStatus}[ $probOrder->[$i] ] %>
<%= hidden_field 'probstatus' . ($problems->[ $probOrder->[$i] ]{problem_id})
=> $c->{probStatus}[ $probOrder->[$i] ] %>
% }
% }
%
Expand Down

0 comments on commit fe0e06a

Please sign in to comment.