More ResponseJSON refactoring

Removed unnecessary $session argument from recordResponses
Refactored nextQuestions to return a list rather than an arrayref
Lots more documentation for ResponseJSON
More param validation for ResponseJSON
Refactored recordResponses
Updated tests
This commit is contained in:
Patrick Donelan 2009-02-06 01:55:56 +00:00
parent 90d314d2f1
commit 932a033b58
4 changed files with 174 additions and 128 deletions

View file

@ -802,7 +802,7 @@ sub www_submitQuestions {
$self->loadBothJSON();
my $termInfo = $self->response->recordResponses( $self->session, $responses );
my $termInfo = $self->response->recordResponses( $responses );
$self->saveResponseJSON();
@ -871,8 +871,8 @@ sub www_loadQuestions {
return $self->surveyEnd();
}
my $questions;
eval { $questions = $self->response->nextQuestions(); };
my @questions;
eval { @questions = $self->response->nextQuestions(); };
my $section = $self->response->nextSection();
@ -880,7 +880,7 @@ sub www_loadQuestions {
$section->{id} = $self->response->nextSectionId();
$section->{wasRestarted} = $wasRestarted;
my $text = $self->prepareShowSurveyTemplate( $section, $questions );
my $text = $self->prepareShowSurveyTemplate( $section, \@questions );
return $text;
} ## end sub www_loadQuestions