diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Around.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 1e06beef1..370fe7b89 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -182,13 +182,17 @@ sub display_location : Private { # create a list of all the pins my @pins; unless ($c->req->param('no_pins')) { - @pins = map { { - latitude => $_->{latitude}, - longitude => $_->{longitude}, - colour => $_->{state} eq 'fixed' ? 'green' : 'red', - id => $_->{id}, - title => $_->{title}, - } } @$on_map_all, @$around_map; + @pins = map { + # Here we might have a DB::Problem or a DB::Nearby, we always want the problem. + my $p = (ref $_ eq 'FixMyStreet::App::Model::DB::Nearby') ? $_->problem : $_; + { + latitude => $p->latitude, + longitude => $p->longitude, + colour => $p->state eq 'fixed' ? 'green' : 'red', + id => $p->id, + title => $p->title, + } + } @$on_map_all, @$around_map; } { # FIXME - ideally this indented code should be in the templates |