aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Questionnaire.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Questionnaire.pm')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Questionnaire.pm28
1 files changed, 14 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
index 6aa4f7604..f0cc72e07 100755
--- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm
+++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
@@ -31,27 +31,27 @@ sub check_questionnaire : Private {
my $questionnaire = $c->stash->{questionnaire};
- my $problem_id = $questionnaire->problem_id;
+ my $problem = $questionnaire->problem;
if ( $questionnaire->whenanswered ) {
- my $problem_url = $c->uri_for( "/report/$problem_id" );
+ my $problem_url = $c->cobrand->base_url_for_report( $problem ) . $problem->url;
my $contact_url = $c->uri_for( "/contact" );
$c->stash->{message} = sprintf(_("You have already answered this questionnaire. If you have a question, please <a href='%s'>get in touch</a>, or <a href='%s'>view your problem</a>.\n"), $contact_url, $problem_url);
$c->stash->{template} = 'errors/generic.html';
$c->detach;
}
- unless ( $questionnaire->problem->is_visible ) {
+ unless ( $problem->is_visible ) {
$c->detach('missing_problem');
}
- $c->stash->{problem} = $questionnaire->problem;
- $c->stash->{answered_ever_reported} = $questionnaire->problem->user->answered_ever_reported;
+ $c->stash->{problem} = $problem;
+ $c->stash->{answered_ever_reported} = $problem->user->answered_ever_reported;
# EHA needs to know how many to alter display, and whether to send another or not
if ($c->cobrand->moniker eq 'emptyhomes') {
$c->stash->{num_questionnaire} = $c->model('DB::Questionnaire')->count(
- { problem_id => $c->stash->{problem}->id }
+ { problem_id => $problem->id }
);
}
@@ -96,15 +96,16 @@ sub submit_creator_fixed : Private {
my @errors;
- map { $c->stash->{$_} = $c->req->params->{$_} || '' } qw(reported problem);
+ $c->stash->{reported} = $c->req->params->{reported};
+ $c->stash->{problem_id} = $c->req->params->{problem};
# should only be able to get to here if we are logged and we have a
# problem
- unless ( $c->user && $c->stash->{problem} ) {
+ unless ( $c->user && $c->stash->{problem_id} ) {
$c->detach('missing_problem');
}
- my $problem = $c->cobrand->problems->find( { id => $c->stash->{problem} } );
+ my $problem = $c->cobrand->problems->find( { id => $c->stash->{problem_id} } );
# you should not be able to answer questionnaires about problems
# that you've not submitted
@@ -114,13 +115,12 @@ sub submit_creator_fixed : Private {
push @errors, _('Please say whether you\'ve ever reported a problem to your council before') unless $c->stash->{reported};
- $c->stash->{problem_id} = $c->stash->{problem};
$c->stash->{errors} = \@errors;
$c->detach( 'creator_fixed' ) if scalar @errors;
my $questionnaire = $c->model( 'DB::Questionnaire' )->find_or_new(
{
- problem_id => $c->stash->{problem},
+ problem_id => $c->stash->{problem_id},
# we want to look for any previous questionnaire here rather than one for
# this specific open state -> fixed transistion
old_state => [ FixMyStreet::DB::Result::Problem->open_states() ],
@@ -199,7 +199,7 @@ sub submit_standard : Private {
mark_open => $new_state eq 'confirmed' ? 1 : 0,
lang => $c->stash->{lang_code},
cobrand => $c->cobrand->moniker,
- cobrand_data => $c->cobrand->extra_update_data,
+ cobrand_data => '',
confirmed => \'ms_current_timestamp()',
anonymous => $problem->anonymous,
}
@@ -281,10 +281,10 @@ sub display : Private {
map { Utils::truncate_coordinate($_) }
( $problem->latitude, $problem->longitude );
- $c->stash->{updates} = $c->model('DB::Comment')->search(
+ $c->stash->{updates} = [ $c->model('DB::Comment')->search(
{ problem_id => $problem->id, state => 'confirmed' },
{ order_by => 'confirmed' }
- );
+ )->all ];
$c->stash->{page} = 'questionnaire';
FixMyStreet::Map::display_map(