diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-07-02 16:36:35 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-07-02 16:36:35 +0100 |
commit | 6e3ea5f3fbc56919dd183276bfb84b1deef9c21c (patch) | |
tree | cbf63e1977ea545e2f2fa625f9a3444af3b4273a /perllib/FixMyStreet/Cobrand/UK.pm | |
parent | 3b45695dddd4aa35e7b04a2a10b8e7732217e155 (diff) | |
parent | dadddc42f5e5c4b3a02db9171a485885b1e365a7 (diff) |
Merge branch 'use-the-body-id'
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/UK.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index f7b71b0ae..ebedf8711 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -190,9 +190,11 @@ sub council_rss_alert_options { my ( @options, @reported_to_options ); if ( $num_councils == 1 or $num_councils == 2 ) { my ($council, $ward); + my $body = FixMyStreet::DB->resultset('Body')->active->search({ name => { '!=' => 'TfL' } })->for_areas(keys %$all_areas)->first; foreach (values %$all_areas) { if ($councils{$_->{type}}) { $council = $_; + $council->{id} = $body->id; # Want to use body ID, not MapIt area ID $council->{short_name} = $self->short_name( $council ); ( $council->{id_name} = $council->{short_name} ) =~ tr/+/_/; } else { @@ -247,6 +249,9 @@ sub council_rss_alert_options { my $county_name = $county->{name}; my $c_ward_name = $c_ward->{name}; + my $body_dis = FixMyStreet::DB->resultset('Body')->active->for_areas($district->{id})->first; + my $body_cty = FixMyStreet::DB->resultset('Body')->active->for_areas($county->{id})->first; + push @options, { type => 'area', id => sprintf( 'area:%s:%s', $district->{id}, $district->{id_name} ), @@ -275,25 +280,25 @@ sub council_rss_alert_options { push @reported_to_options, { type => 'council', - id => sprintf( 'council:%s:%s', $district->{id}, $district->{id_name} ), + id => sprintf( 'council:%s:%s', $body_dis->id, $district->{id_name} ), text => sprintf( _('Reports sent to %s'), $district->{name} ), rss_text => sprintf( _('RSS feed of %s'), $district->{name}), uri => $c->uri_for( '/rss/reports/' . $district->{short_name} ), }, { type => 'ward', - id => sprintf( 'ward:%s:%s:%s:%s', $district->{id}, $d_ward->{id}, $district->{id_name}, $d_ward->{id_name} ), + id => sprintf( 'ward:%s:%s:%s:%s', $body_dis->id, $d_ward->{id}, $district->{id_name}, $d_ward->{id_name} ), rss_text => sprintf( _('RSS feed of %s, within %s ward'), $district->{name}, $d_ward->{name}), text => sprintf( _('Reports sent to %s, within %s ward'), $district->{name}, $d_ward->{name}), uri => $c->uri_for( '/rss/reports/' . $district->{short_name} . '/' . $d_ward->{short_name} ), }, { type => 'council', - id => sprintf( 'council:%s:%s', $county->{id}, $county->{id_name} ), + id => sprintf( 'council:%s:%s', $body_cty->id, $county->{id_name} ), text => sprintf( _('Reports sent to %s'), $county->{name} ), rss_text => sprintf( _('RSS feed of %s'), $county->{name}), uri => $c->uri_for( '/rss/reports/' . $county->{short_name} ), }, { type => 'ward', - id => sprintf( 'ward:%s:%s:%s:%s', $county->{id}, $c_ward->{id}, $county->{id_name}, $c_ward->{id_name} ), + id => sprintf( 'ward:%s:%s:%s:%s', $body_cty->id, $c_ward->{id}, $county->{id_name}, $c_ward->{id_name} ), rss_text => sprintf( _('RSS feed of %s, within %s ward'), $county->{name}, $c_ward->{name}), text => sprintf( _('Reports sent to %s, within %s ward'), $county->{name}, $c_ward->{name}), uri => $c->uri_for( '/rss/reports/' . $county->{short_name} . '/' . $c_ward->{short_name} ), |