aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Map.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Map.pm')
-rw-r--r--perllib/FixMyStreet/Map.pm26
1 files changed, 13 insertions, 13 deletions
diff --git a/perllib/FixMyStreet/Map.pm b/perllib/FixMyStreet/Map.pm
index b6b618efb..e0e3c3128 100644
--- a/perllib/FixMyStreet/Map.pm
+++ b/perllib/FixMyStreet/Map.pm
@@ -88,23 +88,23 @@ sub map_features {
$p{latitude} = ($p{max_lat} + $p{min_lat} ) / 2;
}
- # list of problems around map can be limited, but should show all pins
- my $around_limit = $c->cobrand->on_map_list_limit || undef;
-
- my $on_map_all = $c->cobrand->problems_on_map->around_map( undef, %p );
- my $on_map_list = $around_limit
- ? $c->cobrand->problems_on_map->around_map( $around_limit, %p )
- : $on_map_all;
+ $p{page} = $c->get_param('p') || 1;
+ my $on_map = $c->cobrand->problems_on_map->around_map( $c, %p );
+ my $pager = $c->stash->{pager} = $on_map->pager;
+ $on_map = [ $on_map->all ];
my $dist = FixMyStreet::Gaze::get_radius_containing_population( $p{latitude}, $p{longitude} );
- my $limit = 20;
- my @ids = map { $_->id } @$on_map_list;
- my $nearby = $c->model('DB::Nearby')->nearby(
- $c, $dist, \@ids, $limit, @p{"latitude", "longitude", "interval", "categories", "states"}
- );
+ my $nearby;
+ if (@$on_map < $pager->entries_per_page && $pager->current_page == 1) {
+ my $limit = 20;
+ my @ids = map { $_->id } @$on_map;
+ $nearby = $c->model('DB::Nearby')->nearby(
+ $c, $dist, \@ids, $limit, @p{"latitude", "longitude", "categories", "states"}
+ );
+ }
- return ( $on_map_all, $on_map_list, $nearby, $dist );
+ return ( $on_map, $nearby, $dist );
}
sub click_to_wgs84 {