aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Alert.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Alert.pm')
-rw-r--r--perllib/FixMyStreet/Alert.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/Alert.pm b/perllib/FixMyStreet/Alert.pm
index b9c124741..90a5b1aaa 100644
--- a/perllib/FixMyStreet/Alert.pm
+++ b/perllib/FixMyStreet/Alert.pm
@@ -184,12 +184,11 @@ sub email_alerts ($) {
$query->execute();
while (my $alert = $query->fetchrow_hashref) {
next unless (Cobrand::email_host($alert->{cobrand}));
- my $e = $alert->{parameter};
- my $n = $alert->{parameter2};
+ my $longitude = $alert->{parameter};
+ my $latitude = $alert->{parameter2};
$url = Cobrand::base_url_for_emails($alert->{cobrand}, $alert->{cobrand_data});
my ($site_restriction, $site_id) = Cobrand::site_restriction($alert->{cobrand}, $alert->{cobrand_data});
- my ($lat, $lon) = mySociety::GeoUtil::national_grid_to_wgs84($e, $n, 'G');
- my $d = mySociety::Gaze::get_radius_containing_population($lat, $lon, 200000);
+ my $d = mySociety::Gaze::get_radius_containing_population($latitude, $longitude, 200000);
$d = int($d*10+0.5)/10;
my $testing_email_clause = "and problem.email <> '$testing_email'" if $testing_email;
my %data = ( template => $template, data => '', alert_id => $alert->{id}, alert_email => $alert->{email}, lang => $alert->{lang}, cobrand => $alert->{cobrand}, cobrand_data => $alert->{cobrand_data} );
@@ -202,7 +201,7 @@ sub email_alerts ($) {
$site_restriction
order by confirmed desc";
$q = dbh()->prepare($q);
- $q->execute($e, $n, $d, $alert->{whensubscribed}, $alert->{id}, $alert->{email});
+ $q->execute($latitude, $longitude, $d, $alert->{whensubscribed}, $alert->{id}, $alert->{email});
while (my $row = $q->fetchrow_hashref) {
dbh()->do('insert into alert_sent (alert_id, parameter) values (?,?)', {}, $alert->{id}, $row->{id});
$data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}\n\n";
@@ -310,9 +309,8 @@ sub generate_rss ($$$;$$$$) {
}
$item{description} .= ent("\n<br><a href='$cobrand_url'>Report on FixMyStreet</a>");
- if ($row->{easting} && $row->{northing}) {
- my ($lat,$lon) = mySociety::GeoUtil::national_grid_to_wgs84($row->{easting}, $row->{northing}, 'G');
- $item{georss} = { point => "$lat $lon" };
+ if ($row->{latitude} || $row->{longitude}) {
+ $item{georss} = { point => "$row->{latitude} $row->{longitude}" };
}
$rss->add_item( %item );
}