diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Greenwich.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Nearby.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map.pm | 14 |
8 files changed, 11 insertions, 51 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 33b1dd740..b870c1a19 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -249,16 +249,11 @@ sub map_features : Private { $c->forward( '/reports/stash_report_filter_status' ); $c->forward( '/reports/stash_report_sort', [ 'created-desc' ]); - # Deal with pin hiding/age - my $all_pins = $c->get_param('all_pins') ? 1 : undef; - $c->stash->{all_pins} = $all_pins; - my $interval = $all_pins ? undef : $c->cobrand->on_map_default_max_pin_age; - return if $c->get_param('js'); # JS will request the same (or more) data client side - my ( $on_map_all, $on_map_list, $nearby, $distance ) = + my ( $on_map, $nearby, $distance ) = FixMyStreet::Map::map_features( - $c, interval => $interval, %$extra, + $c, %$extra, categories => [ keys %{$c->stash->{filter_category}} ], states => $c->stash->{filter_problem_states}, order => $c->stash->{sort_order}, @@ -270,11 +265,11 @@ sub map_features : Private { # Here we might have a DB::Problem or a DB::Result::Nearby, we always want the problem. my $p = (ref $_ eq 'FixMyStreet::DB::Result::Nearby') ? $_->problem : $_; $p->pin_data($c, 'around'); - } @$on_map_all, @$nearby; + } @$on_map, @$nearby; } $c->stash->{pins} = \@pins; - $c->stash->{on_map} = $on_map_list; + $c->stash->{on_map} = $on_map; $c->stash->{around_map} = $nearby; $c->stash->{distance} = $distance; } diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 138098d5f..3913f4906 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -521,7 +521,7 @@ sub nearby_json : Private { my $dist = 1; my $nearby = $c->model('DB::Nearby')->nearby( - $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, undef, [ $p->category ], undef + $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, [ $p->category ], undef ); my @pins = map { my $p = $_->problem; diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index e7d5e186a..2f47225a7 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -59,10 +59,6 @@ sub map_type { 'Bromley'; } -sub on_map_default_max_pin_age { - return '1 month'; -} - # Bromley pins always yellow sub pin_colour { my ( $self, $p, $context ) = @_; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 9e49099aa..ada1058f5 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -437,22 +437,6 @@ sub reports_ordering { return 'updated-desc'; } -=head2 on_map_list_limit - -Return the maximum number of items to be given in the list of reports on the map - -=cut - -sub on_map_list_limit { return undef; } - -=head2 on_map_default_max_pin_age - -Return the default maximum age for pins. - -=cut - -sub on_map_default_max_pin_age { return '6 months'; } - =head2 on_map_default_status Return the default ?status= query parameter to use for filter on map page. diff --git a/perllib/FixMyStreet/Cobrand/Greenwich.pm b/perllib/FixMyStreet/Cobrand/Greenwich.pm index ce4fae381..6ff30e83d 100644 --- a/perllib/FixMyStreet/Cobrand/Greenwich.pm +++ b/perllib/FixMyStreet/Cobrand/Greenwich.pm @@ -57,10 +57,6 @@ sub contact_email { sub reports_per_page { return 20; } -sub on_map_default_max_pin_age { - return '21 days'; -} - sub open311_config { my ($self, $row, $h, $params) = @_; diff --git a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm index 8b8951007..6e5e0220f 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm @@ -10,7 +10,7 @@ sub to_body { } sub nearby { - my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $interval, $categories, $states ) = @_; + my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $categories, $states ) = @_; unless ( $states ) { $states = FixMyStreet::DB::Result::Problem->visible_states(); @@ -20,8 +20,6 @@ sub nearby { non_public => 0, state => [ keys %$states ], }; - $params->{'current_timestamp-lastupdate'} = { '<', \"'$interval'::interval" } - if $interval; $params->{id} = { -not_in => $ids } if $ids; $params->{category} = $categories if $categories && @$categories; diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index f1ed50721..5cbf4e8f0 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -140,11 +140,10 @@ sub _recent { # Problems around a location sub around_map { - my ( $rs, $limit, %p) = @_; + my ( $rs, %p) = @_; my $attr = { order_by => $p{order}, }; - $attr->{rows} = $limit if $limit; unless ( $p{states} ) { $p{states} = FixMyStreet::DB::Result::Problem->visible_states(); @@ -156,8 +155,6 @@ 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 }; diff --git a/perllib/FixMyStreet/Map.pm b/perllib/FixMyStreet/Map.pm index b6b618efb..46a098117 100644 --- a/perllib/FixMyStreet/Map.pm +++ b/perllib/FixMyStreet/Map.pm @@ -88,23 +88,17 @@ 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; + my $on_map = $c->cobrand->problems_on_map->around_map( %p ); my $dist = FixMyStreet::Gaze::get_radius_containing_population( $p{latitude}, $p{longitude} ); my $limit = 20; - my @ids = map { $_->id } @$on_map_list; + my @ids = map { $_->id } @$on_map; my $nearby = $c->model('DB::Nearby')->nearby( - $c, $dist, \@ids, $limit, @p{"latitude", "longitude", "interval", "categories", "states"} + $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 { |