aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-09-21 15:04:50 +0100
committerStruan Donald <struan@exo.org.uk>2011-09-21 15:04:50 +0100
commit252ba7c5bf2317b21a84400beeeeb804d1f81f65 (patch)
tree9d9feb7c788c7acf203f5306593b4a5950e14758 /perllib/FixMyStreet
parent132a30e6660ee8ec0b3773e20c71c8dbd5e92e0e (diff)
cache the bing gecode data when we fetch in send-reports
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 283de7d75..2e031d740 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -545,10 +545,15 @@ Used by send-reports to attach nearest things to the bottom of the report
=cut
sub find_closest {
- my ( $self, $latitude, $longitude ) = @_;
+ my ( $self, $latitude, $longitude, $problem ) = @_;
my $str = '';
if ( my $j = FixMyStreet::Geocode::Bing::reverse( $latitude, $longitude ) ) {
+ # cache the bing results for use in alerts
+ if ( $problem ) {
+ $problem->geocode( $j );
+ $problem->update;
+ }
if ($j->{resourceSets}[0]{resources}[0]{name}) {
$str .= sprintf(_("Nearest road to the pin placed on the map (automatically generated by Bing Maps): %s"),
$j->{resourceSets}[0]{resources}[0]{name}) . "\n\n";