Skip to content

Commit

Permalink
[FMS] Make sure /reports link for Kingston work
Browse files Browse the repository at this point in the history
Rather than directing back to the dashboard page.
We already had checks for Bexley & Greenwich, whose full names
start with 'London|Royal Borough of'; we needed a check for
Kingston upon Thames as well.
  • Loading branch information
nephila-nacrea committed Dec 17, 2024
1 parent e0a2fea commit 5c5a759
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 8 additions & 3 deletions perllib/FixMyStreet/Cobrand/UK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ sub short_name {
return $name;
}

sub is_london_or_royal {
my ( $self, $short_name ) = @_;

return $short_name =~ /bexley|greenwich|kingston/i;
}

sub find_closest {
my ($self, $data) = @_;

Expand All @@ -149,9 +155,8 @@ sub find_closest {

sub reports_body_check {
my ( $self, $c, $code ) = @_;

# Deal with Bexley and Greenwich name not starting with short name
if ($code =~ /bexley|greenwich/i) {
# Some full names do not start with short name
if ( $self->is_london_or_royal($code) ) {
my $body = $c->model('DB::Body')->search( { name => { -like => "%$code%" } } )->single;
$c->stash->{body} = $body;
return $body;
Expand Down
5 changes: 2 additions & 3 deletions perllib/FixMyStreet/Cobrand/UKCouncils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,8 @@ sub all_reports_single_body {

sub reports_body_check {
my ( $self, $c, $code ) = @_;

# Deal with Bexley/Greenwich name not starting with short name
if ($code =~ /bexley|greenwich/i) {
# Some full names do not start with short name
if ( $self->is_london_or_royal($code) ) {
my $body = $c->model('DB::Body')->search( { name => { -like => "%$code%" } } )->single;
$c->stash->{body} = $body;
return $body;
Expand Down

0 comments on commit 5c5a759

Please sign in to comment.