Skip to content

Commit

Permalink
Merge pull request #935 from drgrice1/fix_extended_responses
Browse files Browse the repository at this point in the history
Fix extended response group questions in multi page gateway quizzes.
  • Loading branch information
mgage authored May 10, 2019
2 parents 8e21ca7 + a3cd2be commit db7eb3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/WeBWorK/ContentGenerator/GatewayQuiz.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ sub body {
# ref($pg) eq "WeBWorK::PG::Local";
} else {
my $prefix = sprintf('Q%04d_',$i+1);
my @fields = sort grep {/^$prefix/} (keys %{$self->{formFields}});
my @fields = sort grep {/^(?!previous).*$prefix/} (keys %{$self->{formFields}});
my %answersToStore = map {$_ => $self->{formFields}->{$_}} @fields;
my @answer_order = @fields;
$encoded_ans_string = encodeAnswers( %answersToStore,
Expand Down Expand Up @@ -1667,7 +1667,7 @@ sub body {
$answerString =~ s/\t+$/\t/;
} else {
my $prefix = sprintf('Q%04d_', ($probOrder[$i]+1));
my @fields = sort grep {/^$prefix/} (keys %{$self->{formFields}});
my @fields = sort grep {/^(?!previous).*$prefix/} (keys %{$self->{formFields}});
foreach ( @fields ) {
$answerString .= $self->{formFields}->{$_} . "\t";
$scores .= $self->{formFields}->{"probstatus" . ($probOrder[$i]+1)} >= 1 ? "1" : "0" if ( $submitAnswers );
Expand Down Expand Up @@ -2190,7 +2190,7 @@ sub body {
# and print out hidden fields with the current
# last answers
my $curr_prefix = 'Q' . sprintf("%04d", $probOrder[$i]+1) . '_';
my @curr_fields = grep /^$curr_prefix/, keys %{$self->{formFields}};
my @curr_fields = grep {/^(?!previous).*$curr_prefix/} keys %{$self->{formFields}};
foreach my $curr_field ( @curr_fields ) {
foreach ( split(/\0/, $self->{formFields}->{$curr_field} // '') ) {
print CGI::hidden({-name=>$curr_field,
Expand Down

0 comments on commit db7eb3b

Please sign in to comment.