diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-07-18 14:28:09 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-07-18 14:28:09 +0100 |
commit | 799b23f0fe03d58116a6ebcd1fa26f5ae77338d4 (patch) | |
tree | 0fd95fc3c965712c0266b8e1ade1b19fedf53382 | |
parent | 299ac2bcc31dd1dff1985e275736f40228fabb76 (diff) |
Fetch updates as report page does, so they're displayed.
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 4 | ||||
-rw-r--r-- | t/app/controller/questionnaire.t | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 6aa4f7604..f3cefb701 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -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( diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index 2d4fdb711..14ceb3212 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -273,6 +273,23 @@ foreach my $test ( }; } +my $comment = FixMyStreet::App->model('DB::Comment')->find_or_create( + { + problem_id => $report->id, + user_id => $user->id, + name => 'A User', + mark_fixed => 'false', + text => 'This is some update text', + state => 'confirmed', + confirmed => $sent_time, + anonymous => 'f', + } +); +subtest 'Check updates are shown correctly on questionnaire page' => sub { + $mech->get_ok("/Q/" . $token->token); + $mech->content_contains( 'updates that have been left' ); + $mech->content_contains( 'This is some update text' ); +}; for my $test ( { |