Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Brent] Add nsg mapping config. #4966

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
}
}

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
Loading