diff options
-rwxr-xr-x | bin/send-reports | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/bin/send-reports b/bin/send-reports index 9ab6f8274..fc8ee6e45 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -90,7 +90,7 @@ while (my $row = $unsent->next) { } if ( $row->used_map ) { - $h{closest_address} = $cobrand->find_closest( $h{latitude}, $h{longitude} ); + $h{closest_address} = $cobrand->find_closest( $h{latitude}, $h{longitude}, $row ); } my (@to, @recips, $template, $areas_info); 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"; |