Skip to content

Commit

Permalink
[Brent] Don't show TfL Bus station categories
Browse files Browse the repository at this point in the history
There is only one bus station in Brent and Brent
don't want to have a category for it.
mysociety/societyworks#4521
  • Loading branch information
MorayMySoc committed Sep 2, 2024
1 parent 6ded89d commit 32735ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions perllib/FixMyStreet/Cobrand/Brent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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)' } ] } );

Check warning on line 331 in perllib/FixMyStreet/Cobrand/Brent.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Brent.pm#L331

Added line #L331 was not covered by tests
}

=head2 social_auth_enabled, user_from_oidc, and oidc_config
Expand Down
6 changes: 6 additions & 0 deletions t/cobrand/brent.t
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,18 @@ FixMyStreet::override_config {
$mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers', email => '[email protected]');
$mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers - Cleaning', email => '[email protected]');
$mech->create_contact_ok(body_id => $tfl->id, category => 'River Piers Damage doors and glass', email => '[email protected]');
$mech->create_contact_ok(body_id => $tfl->id, category => 'Bus Station Cleaning - General', email => '[email protected]');
$mech->create_contact_ok(body_id => $tfl->id, category => 'Graffiti / Flyposting (Response Desk Buses to Action)', email => '[email protected]');

$mech->create_contact_ok(body_id => $tfl->id, category => 'Sweeping', email => '[email protected]');
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 {
Expand Down

0 comments on commit 32735ea

Please sign in to comment.