Survey sections now have logical section type, which is never shown to the user, only used for silently checking gotos.

This commit is contained in:
Kaleb Murphy 2009-04-30 20:43:23 +00:00
parent e25094a16e
commit 54063ae9f6
5 changed files with 21 additions and 2 deletions

View file

@ -439,6 +439,7 @@ sub recordResponses {
# We want to record responses against the "next" response section and questions, since these are
# the items that have just been displayed to the user.
my $section = $self->nextResponseSection();
my @questions = $self->nextQuestions();
#GOTO jumps in the Survey. Order of precedence is Answer, Question, then Section.
@ -461,7 +462,7 @@ sub recordResponses {
}
# Handle empty Section..
if ( !@questions ) {
if ( !@questions and !$section->{logical}) {
# No questions to process, so increment lastResponse and return
$self->lastResponse( $self->nextResponse );
return [ $sTerminal, $terminalUrl ];
@ -556,13 +557,18 @@ sub recordResponses {
# If all required responses were given, proceed onwards!
if ($allRequiredQsAnswered) {
# Move the lastResponse index to the last question answered
$self->lastResponse( $self->lastResponse + @questions );
# Do any requested branching..
$self->processGoto($goto) if ( defined $goto ); ## no critic
$self->processGotoExpression($gotoExpression) if ( defined $gotoExpression ); ## no critic
# Handle next logic Section..
my $section = $self->nextResponseSection();
if($section and $section->{logical}){
return $self->recordResponses({});
}
}
else {
# Required responses were missing, so we don't let the Survey terminate