diff options
author | Struan Donald <struan@exo.org.uk> | 2020-07-06 17:03:48 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2020-07-06 17:03:48 +0100 |
commit | 208935e97fdaa50be69affe176028a8872395c69 (patch) | |
tree | ae3726559f6820702d27b25f55c630650fc0c11c | |
parent | ed9c0ebaee7f00d5e4593c75aaab4815ac296ef7 (diff) |
[Hackney] skip hackney categories for TfL red routes
Because Hackney doesn't have any matching categories for TfL red routes
skip sending the body, otherwise you get a "no contact details" message
when you click on a red route in Hackney
-rw-r--r-- | perllib/FixMyStreet/Cobrand/TfL.pm | 7 | ||||
-rw-r--r-- | t/Mock/MapIt.pm | 1 | ||||
-rw-r--r-- | t/Mock/Tilma.pm | 2 | ||||
-rw-r--r-- | t/cobrand/tfl.t | 28 |
4 files changed, 36 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm index c37b9a0e5..9620c6b9e 100644 --- a/perllib/FixMyStreet/Cobrand/TfL.pm +++ b/perllib/FixMyStreet/Cobrand/TfL.pm @@ -437,6 +437,13 @@ sub munge_surrounding_london { # Don't send any TfL categories %$bodies = map { $_->id => $_ } grep { $_->name ne 'TfL' } values %$bodies; } + + # Hackney doesn't have any of the council TfL categories so don't show + # any Hackney categories on red routes + my %bodies = map { $_->name => $_->id } values %$bodies; + if ( $bodies{'Hackney Council'} && $self->report_new_is_on_tlrn ) { + delete $bodies->{ $bodies{'Hackney Council'} }; + } } sub munge_red_route_categories { diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm index ed95e71fc..760e0ba52 100644 --- a/t/Mock/MapIt.pm +++ b/t/Mock/MapIt.pm @@ -45,6 +45,7 @@ my @PLACES = ( [ '?', 52.238827, -0.894970, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ], [ '?', 52.23025, -1.015826, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ], [ 'E8 1DY', 51.552267, -0.063316, 2508, 'Hackney Borough Council', 'LBO' ], + [ 'E8 2DY', 51.552287, -0.063326, 2508, 'Hackney Council', 'LBO' ], [ 'TW7 5JN', 51.482286, -0.328163, 2483, 'Hounslow Borough Council', 'LBO' ], [ '?', 51.48111, -0.327219, 2483, 'Hounslow Borough Council', 'LBO' ], [ '?', 51.482045, -0.327219, 2483, 'Hounslow Borough Council', 'LBO' ], diff --git a/t/Mock/Tilma.pm b/t/Mock/Tilma.pm index 7542b1f5e..b7ef2be2f 100644 --- a/t/Mock/Tilma.pm +++ b/t/Mock/Tilma.pm @@ -28,7 +28,7 @@ sub dispatch_request { sub (GET + /mapserver/tfl + ?*) { my ($self, $args) = @_; my $features = []; - if ($args->{Filter} =~ /540512,169141/) { + if ($args->{Filter} =~ /540512,169141|534371,185488/) { $features = [ { type => "Feature", properties => { HA_ID => "19" }, geometry => { type => "Polygon", coordinates => [ [ [ 539408.94, 170607.58 ], diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t index f8e0a11c8..cf1ec1c41 100644 --- a/t/cobrand/tfl.t +++ b/t/cobrand/tfl.t @@ -23,6 +23,10 @@ FixMyStreet::DB->resultset('BodyArea')->find_or_create({ area_id => 2457, # Epsom Ewell, outside London, for bus stop test body_id => $body->id, }); +FixMyStreet::DB->resultset('BodyArea')->find_or_create({ + area_id => 2508, # Hackney + body_id => $body->id, +}); my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1); my $staffuser = $mech->create_user_ok('counciluser@example.com', name => 'Council User', from_body => $body, password => 'password'); $staffuser->user_body_permissions->create({ @@ -58,6 +62,13 @@ my $bromley_flytipping = $mech->create_contact_ok( $bromley_flytipping->set_extra_metadata(group => [ 'Street cleaning' ]); $bromley_flytipping->update; +my $hackney = $mech->create_body_ok(2508, 'Hackney Council'); +$mech->create_contact_ok( + body_id => $hackney->id, + category => 'Abandoned Vehicle', + email => 'av-hackney@example.com', +); + my $contact1 = $mech->create_contact_ok( body_id => $body->id, category => 'Bus stops', @@ -748,7 +759,7 @@ subtest 'Test no questionnaire sending' => sub { }; FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'tfl', 'bromley', 'fixmystreet' ], + ALLOWED_COBRANDS => [ 'tfl', 'bromley', 'fixmystreet', 'hackney' ], MAPIT_URL => 'http://mapit.uk/', COBRAND_FEATURES => { internal_ips => { tfl => [ '127.0.0.1' ] }, @@ -864,6 +875,21 @@ for my $test ( 'Trees' ], }, + { + host => 'hackney.fixmystreet.com', + name => "test no hackney categories on red route", + lat => 51.552287, + lon => -0.063326, + expected => [ + 'Bus stops', + 'Flooding', + 'Grit bins', + 'Pothole', + 'Timings', + 'Traffic lights', + 'Trees' + ], + }, ) { subtest $test->{name} . ' on ' . $test->{host} => sub { $mech->host($test->{host}); |