diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-11-06 12:26:26 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-11-06 12:26:26 +0000 |
commit | 53e22391a3975b2c2a9ebca8b75fab6127c767b7 (patch) | |
tree | 8c667b07a9c07dbc0c11e2d3bb003b6da9dc6db2 /perllib/FixMyStreet/DB/ResultSet/Problem.pm | |
parent | 91bec61612a5ad0c4ee87942dae0611a9a211243 (diff) | |
parent | 27f6a53b0be0e36ffccbabd45592ee6fddf0092a (diff) |
Merge branch 'around-and-about-pagination'
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index f1ed50721..ae45351c4 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -140,11 +140,11 @@ sub _recent { # Problems around a location sub around_map { - my ( $rs, $limit, %p) = @_; + my ( $rs, $c, %p) = @_; my $attr = { order_by => $p{order}, }; - $attr->{rows} = $limit if $limit; + $attr->{rows} = $c->cobrand->reports_per_page; unless ( $p{states} ) { $p{states} = FixMyStreet::DB::Result::Problem->visible_states(); @@ -156,12 +156,12 @@ sub around_map { latitude => { '>=', $p{min_lat}, '<', $p{max_lat} }, longitude => { '>=', $p{min_lon}, '<', $p{max_lon} }, }; - $q->{'current_timestamp - lastupdate'} = { '<', \"'$p{interval}'::interval" } - if $p{interval}; $q->{category} = $p{categories} if $p{categories} && @{$p{categories}}; - my @problems = mySociety::Locale::in_gb_locale { $rs->search( $q, $attr )->include_comment_counts->all }; - return \@problems; + my $problems = mySociety::Locale::in_gb_locale { + $rs->search( $q, $attr )->include_comment_counts->page($p{page}); + }; + return $problems; } # Admin functions |