Skip to content

Commit ad18de4

Browse files
committed
Fix random order page change issue.
I bet you thought all of the random order gateway test issues were resolved. Nope. When a page change occurs in a random order test, the answers saved in the hidden inputs for the problems not on the current page are still not respecting the order. As a result the answers get moved around to incorrect problems each time that a page change occurs.
1 parent 7b813ba commit ad18de4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/WeBWorK/ContentGenerator/GatewayQuiz.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ async sub pre_header_initialize ($c) {
971971
create_ans_str_from_responses($c->{formFields}, $pg_result,
972972
$pureProblem->flags =~ /:needs_grading/);
973973
} else {
974-
my $prefix = sprintf('Q%04d_', $problemNumbers[$i]);
974+
my $prefix = sprintf('Q%04d_', $problemNumbers[ $probOrder[$i] ]);
975975
my @fields = sort grep {/^(?!previous).*$prefix/} (keys %{ $c->{formFields} });
976976
my %answersToStore = map { $_ => $c->{formFields}->{$_} } @fields;
977977
my @answer_order = @fields;

0 commit comments

Comments
 (0)