diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 9 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Council.pm | 14 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Open311.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 8 |
4 files changed, 17 insertions, 18 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 58977473f..4de3d0d1e 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -221,10 +221,10 @@ sub council_list : Path('council_list') : Args(0) { $c->stash->{edit_activity} = $edit_activity; # Not London, as treated separately - my @area_types = $c->cobrand->moniker eq 'emptyhomes' + my $area_types = $c->cobrand->moniker eq 'emptyhomes' ? $c->cobrand->area_types - : grep { $_ ne 'LBO' } $c->cobrand->area_types; - my $areas = mySociety::MaPit::call('areas', \@area_types); + : [ grep { $_ ne 'LBO' } @{ $c->cobrand->area_types } ]; + my $areas = mySociety::MaPit::call('areas', $area_types); my @councils_ids = sort { strcoll($areas->{$a}->{name}, $areas->{$b}->{name}) } keys %$areas; @councils_ids = $c->cobrand->filter_all_council_ids_list( @councils_ids ); @@ -1255,8 +1255,7 @@ sub check_page_allowed : Private { sub set_up_council_details : Private { my ($self, $c ) = @_; - my @area_types = $c->cobrand->area_types; - my $areas = mySociety::MaPit::call('areas', \@area_types); + my $areas = mySociety::MaPit::call('areas', $c->cobrand->area_types); my @councils_ids = sort { strcoll($areas->{$a}->{name}, $areas->{$b}->{name}) } keys %$areas; @councils_ids = $c->cobrand->filter_all_council_ids_list( @councils_ids ); diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index fbdc5261f..a6ce533e4 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -23,8 +23,8 @@ there are no councils then return false. sub load_and_check_councils_and_wards : Private { my ( $self, $c ) = @_; - my @area_types = ( $c->cobrand->area_types(), $c->cobrand->area_types_children() ); - $c->stash->{area_types} = \@area_types; + my $area_types = [ @{$c->cobrand->area_types}, @{$c->cobrand->area_types_children} ]; + $c->stash->{area_types} = $area_types; $c->forward('load_and_check_councils'); } @@ -42,11 +42,11 @@ sub load_and_check_councils : Private { my $longitude = $c->stash->{longitude}; # Look up councils and do checks for the point we've got - my @area_types; + my $area_types; if ( $c->stash->{area_types} and scalar @{ $c->stash->{area_types} } ) { - @area_types = @{ $c->stash->{area_types} }; + $area_types = $c->stash->{area_types}; } else { - @area_types = $c->cobrand->area_types(); + $area_types = $c->cobrand->area_types; } my $short_latitude = Utils::truncate_coordinate($latitude); @@ -55,7 +55,7 @@ sub load_and_check_councils : Private { # TODO: I think we want in_gb_locale around the MaPit line, needs testing my $all_councils; if ( $c->stash->{fetch_all_areas} ) { - my %area_types = map { $_ => 1 } @area_types; + my %area_types = map { $_ => 1 } @$area_types; my $all_areas = mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude" ); $c->stash->{all_areas} = $all_areas; @@ -67,7 +67,7 @@ sub load_and_check_councils : Private { } else { $all_councils = mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude", - type => \@area_types ); + type => $area_types ); } if ($all_councils->{error}) { $c->stash->{location_error} = $all_councils->{error}; diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm index 14b790db8..040b0d3e6 100644 --- a/perllib/FixMyStreet/App/Controller/Open311.pm +++ b/perllib/FixMyStreet/App/Controller/Open311.pm @@ -163,10 +163,10 @@ sub get_services : Private { my $categories = $c->model('DB::Contact')->not_deleted; if ($lat || $lon) { - my @area_types = $c->cobrand->area_types; + my $area_types = $c->cobrand->area_types; my $all_councils = mySociety::MaPit::call('point', "4326/$lon,$lat", - type => \@area_types); + type => $area_types); $categories = $categories->search( { area_id => [ keys %$all_councils ], } ); diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index f275410dc..37766db44 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -34,8 +34,8 @@ sub index : Path : Args(0) { # Fetch all areas of the types we're interested in my $areas_info; eval { - my @area_types = $c->cobrand->area_types; - $areas_info = mySociety::MaPit::call('areas', \@area_types, + my $area_types = $c->cobrand->area_types; + $areas_info = mySociety::MaPit::call('areas', $area_types, min_generation => $c->cobrand->area_min_generation ); }; @@ -231,9 +231,9 @@ sub council_check : Private { } # We must now have a string to check - my @area_types = $c->cobrand->area_types; + my $area_types = $c->cobrand->area_types; my $areas = mySociety::MaPit::call( 'areas', $q_council, - type => \@area_types, + type => $area_types, min_generation => $c->cobrand->area_min_generation ); if (keys %$areas == 1) { |