Fixed Survey bug in handling of logical sections

This commit is contained in:
Patrick Donelan 2009-05-20 10:17:46 +00:00
parent c64a1de9f3
commit 867aa51507
2 changed files with 138 additions and 97 deletions

View file

@ -1616,6 +1616,22 @@ sub www_loadQuestions {
my @questions;
eval { @questions = $self->responseJSON->nextQuestions(); };
# Logical sections cause nextResponse to move when nextQuestions is called, so
# persist and changes, and repeat the surveyEnd check in case we are now at the end
$self->persistResponseJSON();
if ( $self->responseJSON->surveyEnd() ) {
$self->session->log->debug('surveyEnd, probably as a result of a Logical Section');
if ( $self->get('quizModeSummary') ) {
if(! $self->session->form->param('shownsummary')){
my ($summary,$html) = $self->getSummary();
my $json = to_json( { type => 'summary', summary => $summary, html => $html });
$self->session->http->setMimeType('application/json');
return $json;
}
}
return $self->surveyEnd();
}
my $section = $self->responseJSON->nextResponseSection();
#return $self->prepareShowSurveyTemplate($section,$questions);