aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Script/Alerts.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-06-26 18:18:56 +0100
committerMatthew Somerville <matthew@mysociety.org>2018-06-28 13:35:23 +0100
commitdadddc42f5e5c4b3a02db9171a485885b1e365a7 (patch)
tree603a745179c5b141211ccb6355fcbeaf7ecaeb95 /perllib/FixMyStreet/Script/Alerts.pm
parent53f3af1fd561d852346902a06ef27c110d0bd2c1 (diff)
[UK] Fix issue when body ID not equal to MapIt ID.
Hitherto when creating a body or ward alert on a UK site, the MapIt area ID has been stored instead of the body ID. This is okay for www.fixmystreet.com which for historical reasons does have body IDs that match MapIt area IDs, but other UK-based sites may well not. The alert lookup looks for body ID, meaning those alerts will not work. Save the body ID instead, plus fix some tests that were making the same assumption.
Diffstat (limited to 'perllib/FixMyStreet/Script/Alerts.pm')
-rw-r--r--perllib/FixMyStreet/Script/Alerts.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Script/Alerts.pm b/perllib/FixMyStreet/Script/Alerts.pm
index 4b5641f9e..a0c25a8fc 100644
--- a/perllib/FixMyStreet/Script/Alerts.pm
+++ b/perllib/FixMyStreet/Script/Alerts.pm
@@ -185,9 +185,12 @@ sub send() {
# Get a report object for its photo and static map
$data{report} = $schema->resultset('Problem')->find({ id => $row->{id} });
}
- if ($ref eq 'area_problems' || $ref eq 'council_problems' || $ref eq 'ward_problems') {
+ if ($ref eq 'area_problems') {
my $va_info = mySociety::MaPit::call('area', $row->{alert_parameter});
$data{area_name} = $va_info->{name};
+ } elsif ($ref eq 'council_problems' || $ref eq 'ward_problems') {
+ my $body = FixMyStreet::DB->resultset('Body')->find({ id => $row->{alert_parameter} });
+ $data{area_name} = $body->name;
}
if ($ref eq 'ward_problems') {
my $va_info = mySociety::MaPit::call('area', $row->{alert_parameter2});