diff options
author | Matthew Somerville <matthew@mysociety.org> | 2014-05-16 12:05:23 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-05-16 14:07:53 +0100 |
commit | bf062b508081521201cf315f483b7aee3a6a0c7b (patch) | |
tree | 01e4284d97b31c6d7fdb9a3a0c7be50d08bb4d26 /perllib/FixMyStreet/App/Controller/Council.pm | |
parent | 825a60275017e7cbf1bab54d350e9019102ef348 (diff) |
Add MAPIT_GENERATION variable, to pin whitelist.
Otherwise, when MapIt Global is updated, the 'point' lookup, as it only
returns the current generation by default, might no longer return the
areas present in the whitelist.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Council.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Council.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index ceec04027..8a174c254 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -53,10 +53,16 @@ sub load_and_check_areas : Private { my $short_longitude = Utils::truncate_coordinate($longitude); my $all_areas; + + my %params; + $params{generation} = $c->config->{MAPIT_GENERATION} + if $c->config->{MAPIT_GENERATION}; + if ( $c->stash->{fetch_all_areas} ) { my %area_types = map { $_ => 1 } @$area_types; $all_areas = - mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude" ); + mySociety::MaPit::call( 'point', + "4326/$short_longitude,$short_latitude", %params ); $c->stash->{all_areas_mapit} = $all_areas; $all_areas = { map { $_ => $all_areas->{$_} } @@ -65,7 +71,8 @@ sub load_and_check_areas : Private { }; } else { $all_areas = - mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude", + mySociety::MaPit::call( 'point', + "4326/$short_longitude,$short_latitude", %params, type => $area_types ); } if ($all_areas->{error}) { |