From 32735ea3f493bfe6c7ec45e04c758c54418eab4a Mon Sep 17 00:00:00 2001 From: Moray Jones Date: Mon, 2 Sep 2024 16:47:57 +0100 Subject: [PATCH] [Brent] Don't show TfL Bus station categories There is only one bus station in Brent and Brent don't want to have a category for it. https://github.com/mysociety/societyworks/issues/4521 --- perllib/FixMyStreet/Cobrand/Brent.pm | 6 ++++-- t/cobrand/brent.t | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/perllib/FixMyStreet/Cobrand/Brent.pm b/perllib/FixMyStreet/Cobrand/Brent.pm index 4ac20120939..f7d65d32b37 100644 --- a/perllib/FixMyStreet/Cobrand/Brent.pm +++ b/perllib/FixMyStreet/Cobrand/Brent.pm @@ -319,14 +319,16 @@ sub pin_colour { =head2 categories_restriction -Doesn't show TfL's River Piers category as no piers in Brent +Doesn't show TfL's River Piers category as no piers in Brent. +Also don't show bus station category as only one in Brent and +never been used to report anything. =cut sub categories_restriction { my ($self, $rs) = @_; - return $rs->search( { 'me.category' => { '-not_like' => 'River Piers%' } } ); + return $rs->search( { 'me.category' => [ '-and' => { '-not_like' => 'River Piers%' }, { '-not_like' => 'Bus Station%' }, { '-not_like' => '%(Response Desk Buses to Action)' } ] } ); } =head2 social_auth_enabled, user_from_oidc, and oidc_config diff --git a/t/cobrand/brent.t b/t/cobrand/brent.t index e1636d88ab1..581540e727e 100644 --- a/t/cobrand/brent.t +++ b/t/cobrand/brent.t @@ -479,12 +479,18 @@ FixMyStreet::override_config { $mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers', email => 'tfl@example.org'); $mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers - Cleaning', email => 'tfl@example.org'); $mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers Damage doors and glass', email => 'tfl@example.org'); + $mech->create_contact_ok(body_id => $tfl->id, category => 'Bus Station Cleaning - General', email => 'tfl@example.org'); + $mech->create_contact_ok(body_id => $tfl->id, category => 'Graffiti / Flyposting (Response Desk Buses to Action)', email => 'tfl@example.org'); + $mech->create_contact_ok(body_id => $tfl->id, category => 'Sweeping', email => 'tfl@example.org'); ok $mech->host('brent.fixmystreet.com'), 'set host'; my $json = $mech->get_ok_json('/report/new/ajax?latitude=51.55904&longitude=-0.28168'); is $json->{by_category}->{"River Piers"}, undef, "Brent doesn't have River Piers category"; is $json->{by_category}->{"River Piers - Cleaning"}, undef, "Brent doesn't have River Piers with hyphen and extra text category"; is $json->{by_category}->{"River Piers Damage doors and glass"}, undef, "Brent doesn't have River Piers with extra text category"; + is $json->{by_category}->{"Bus Station Cleaning - General"}, undef, "Brent doesn't have Bus Station category beginning with 'Bus Station'"; + is $json->{by_category}->{"Graffiti / Flyposting (Response Desk Buses to Action)"}, undef, "Brent doesn't have Bus Station category including 'Response Desk Buses to Action'"; + }; subtest "has the correct pin colours" => sub {