diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Questionnaire.pm')
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 46d6350d7..f9a08e408 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -67,9 +67,16 @@ token), or the mini own-report one (when we'll have a problem ID). sub submit : Path('submit') { my ( $self, $c ) = @_; - if ( $c->req->params->{token} ) { + if (my $token = $c->get_param('token')) { + if ($token eq '_test_') { + $c->stash->{been_fixed} = $c->get_param('been_fixed'); + $c->stash->{new_state} = $c->get_param('new_state'); + $c->stash->{template} = 'questionnaire/completed.html'; + return; + } $c->forward('submit_standard'); - } elsif ( $c->req->params->{problem} ) { + } elsif (my $p = $c->get_param('problem')) { + $c->detach('creator_fixed') if $p eq '_test_'; $c->forward('submit_creator_fixed'); } else { $c->detach( '/page_error_404_not_found' ); @@ -96,8 +103,8 @@ sub submit_creator_fixed : Private { my @errors; - $c->stash->{reported} = $c->req->params->{reported}; - $c->stash->{problem_id} = $c->req->params->{problem}; + $c->stash->{reported} = $c->get_param('reported'); + $c->stash->{problem_id} = $c->get_param('problem'); # should only be able to get to here if we are logged and we have a # problem @@ -106,6 +113,7 @@ sub submit_creator_fixed : Private { } my $problem = $c->cobrand->problems->find( { id => $c->stash->{problem_id} } ); + $c->stash->{problem} = $problem; # you should not be able to answer questionnaires about problems # that you've not submitted @@ -148,7 +156,7 @@ sub submit_creator_fixed : Private { sub submit_standard : Private { my ( $self, $c ) = @_; - $c->forward( '/tokens/load_questionnaire', [ $c->req->params->{token} ] ); + $c->forward( '/tokens/load_questionnaire', [ $c->get_param('token') ] ); $c->forward( 'check_questionnaire' ); $c->forward( 'process_questionnaire' ); @@ -224,7 +232,7 @@ sub submit_standard : Private { sub process_questionnaire : Private { my ( $self, $c ) = @_; - map { $c->stash->{$_} = $c->req->params->{$_} || '' } qw(been_fixed reported another update); + map { $c->stash->{$_} = $c->get_param($_) || '' } qw(been_fixed reported another update); # EHA questionnaires done for you if ($c->cobrand->moniker eq 'emptyhomes') { @@ -279,10 +287,6 @@ sub display : Private { my $problem = $c->stash->{questionnaire}->problem; - ( $c->stash->{short_latitude}, $c->stash->{short_longitude} ) = - map { Utils::truncate_coordinate($_) } - ( $problem->latitude, $problem->longitude ); - $c->stash->{updates} = [ $c->model('DB::Comment')->search( { problem_id => $problem->id, state => 'confirmed' }, { order_by => 'confirmed' } |