Skip to content

Commit

Permalink
[Brent] Add nsg mapping config.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed May 20, 2024
1 parent e96a07a commit f00f0f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions perllib/FixMyStreet/Cobrand/Brent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ sub open311_update_missing_data {
Reports made via the app probably won't have a NSGRef because we don't
display the road layer. Instead we'll look up the closest asset from the
WFS service at the point we're sending the report over Open311.
We also might need to map one value to another.
=cut

Expand All @@ -571,6 +572,12 @@ WFS service at the point we're sending the report over Open311.
}
}

my $ref = $row->get_extra_field_value('NSGRef') || '';
my $cfg = $self->feature('area_code_mapping') || {};

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

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Brent.pm#L575-L576

Added lines #L575 - L576 were not covered by tests
if ($cfg->{$ref}) {
$row->update_extra_field({ name => 'NSGRef', description => 'NSG Ref', value => $cfg->{$ref} });

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

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Brent.pm#L578

Added line #L578 was not covered by tests
}

=item * Adds NSGRef from WFS service as app doesn't include road layer for Echo
Same as Symology above, but different attribute name.
Expand Down
8 changes: 6 additions & 2 deletions t/cobrand/brent.t
Original file line number Diff line number Diff line change
Expand Up @@ -358,20 +358,24 @@ subtest "Open311 attribute changes" => sub {
}
);
$problem->update_extra_field( { name => 'UnitID', value => '234' } );
$problem->update_extra_field( { name => 'NSGRef', value => 'BadUSRN' } );
$problem->update;

FixMyStreet::override_config {
ALLOWED_COBRANDS => 'brent',
MAPIT_URL => 'http://mapit.uk/',
STAGING_FLAGS => { send_reports => 1 },
COBRAND_FEATURES =>
{ anonymous_account => { brent => 'anonymous' }, },
COBRAND_FEATURES => {
anonymous_account => { brent => 'anonymous' },
area_code_mapping => { brent => { BadUSRN => 'GoodUSRN' } },
},
}, sub {
FixMyStreet::Script::Reports::send();
my $req = Open311->test_req_used;
my $c = CGI::Simple->new( $req->content );
is $c->param('attribute[UnitID]'), undef,
'UnitID removed from attributes';
is $c->param('attribute[NSGRef]'), 'GoodUSRN', 'USRN updated';
like $c->param('description'), qr/ukey: 234/,
'UnitID on gully sent across in detail';
my $title = $problem->title
Expand Down

0 comments on commit f00f0f3

Please sign in to comment.