From 3c7162fb8f4016da31ae85714171e60b47d00fe2 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 12 Dec 2008 23:33:33 +0000 Subject: [PATCH] Add POD stubs, fully document goto. Prevent recordResponses from autovivifying mcHash keys. From page to page of questions it does not matter, but if two questions in the same page have an unrecognized, type, the second will be processed differently from the first. --- .../Asset/Wobject/Survey/ResponseJSON.pm | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm index 91dca0625..c2a76ebb6 100644 --- a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm +++ b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm @@ -297,6 +297,10 @@ sub currentSection { #------------------------------------------------------------------- +=head2 recordResponses + +=cut + sub recordResponses { my $self = shift; my $session = shift; @@ -350,7 +354,7 @@ sub recordResponses { { $aAnswered = 1; - if ( $mcTypes{ $question->{questionType} } ) { + if ( exists $mcTypes{ $question->{questionType} } ) { $self->responses->{ $answer->{id} }->{value} = $answer->{recordedAnswer}; } else { @@ -390,6 +394,18 @@ sub recordResponses { #------------------------------------------------------------------- +=head2 goto ( $variable ) + +Looks through all sections and questions for their variable key, in order. If the requested +$variable matches a variable, then the lastResponse is set so that that section or question +is the next displayed. If more than one section or question matches, then the first is used. + +=head3 $variable + +The variable to look for in all sections and questions. + +=cut + sub goto { my $self = shift; my $goto = shift; @@ -409,6 +425,10 @@ sub goto { #------------------------------------------------------------------- +=head2 getPreviousAnswer + +=cut + sub getPreviousAnswer { my $self = shift; my $questionParam = shift; @@ -502,6 +522,10 @@ sub surveyEnd { #------------------------------------------------------------------- +=head2 returnResponsesForReporting + +=cut + sub returnResponseForReporting { my $self = shift; my @responses = ();