diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 16 |
2 files changed, 12 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index ec8df4450..4c68ce414 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -269,7 +269,7 @@ sub map_features : Private { # Allow the cobrand to add in any additional query parameters my $extra_params = $c->cobrand->call_hook('display_location_extra_params'); - my ( $on_map, $nearby, $distance ) = + my ( $on_map, $nearby ) = FixMyStreet::Map::map_features( $c, %$extra, categories => [ keys %{$c->stash->{filter_category}} ], @@ -290,7 +290,6 @@ sub map_features : Private { $c->stash->{pins} = \@pins; $c->stash->{on_map} = $on_map; $c->stash->{around_map} = $nearby; - $c->stash->{distance} = $distance; } =head2 ajax diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 12f6ec1d1..796c2a42b 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -600,16 +600,22 @@ sub nearby_json :PathPart('nearby.json') :Chained('id') :Args(0) { my ($self, $c) = @_; my $p = $c->stash->{problem}; - my $dist = 1; + my $params = { + latitude => $p->latitude, + longitude => $p->longitude, + categories => [ $p->category ], + ids => [ $p->id ], + distance => 1, + }; # This is for the list template, this is a list on that page. $c->stash->{page} = 'report'; - my $extra_params = $c->cobrand->call_hook('display_location_extra_params'); + $params->{extra} = $c->cobrand->call_hook('display_location_extra_params'); + $params->{limit} = 5; + + my $nearby = $c->model('DB::Nearby')->nearby($c, %$params); - my $nearby = $c->model('DB::Nearby')->nearby( - $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, [ $p->category ], undef, $extra_params - ); # Want to treat these as if they were on map $nearby = [ map { $_->problem } @$nearby ]; my @pins = map { |