Skip to content

Commit 73e286e

Browse files
committed
[Bromley] Any streetlight on a Bromley asset should be 'in Bromley'
Set a hidden field when the asset is selected and the report is made so that we can recognise it was on an streetlight belonging to Bromley regardless of the id https://mysocietysupport.freshdesk.com/a/tickets/4815
1 parent bb118a0 commit 73e286e

File tree

7 files changed

+48
-6
lines changed

7 files changed

+48
-6
lines changed

.cypress/cypress/integration/bromley.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ describe('Bromley cobrand', function() {
4545
cy.get('.mobile-map-banner').should('be.visible');
4646
});
4747

48+
it('sets extra cobrand owner field when streetlight asset selected', function() {
49+
cy.pickCategory('Street Lighting and Road Signs');
50+
cy.nextPageReporting();
51+
cy.pickSubcategory('Street Lighting and Road Signs', 'Lamp Column Damaged');
52+
cy.wait('@lights');
53+
cy.nextPageReporting();
54+
cy.get('.mobile-map-banner').should('be.visible');
55+
cy.get('#form_fms_layer_owner').should('have.value', '');
56+
cy.visit('http://bromley.localhost:3001/report/new?longitude=0.022775&latitude=51.398387');
57+
cy.wait('@report-ajax');
58+
cy.get('#mob_ok').click();
59+
cy.pickCategory('Street Lighting and Road Signs');
60+
cy.nextPageReporting();
61+
cy.pickSubcategory('Street Lighting and Road Signs', 'Lamp Column Damaged');
62+
cy.wait('@lights');
63+
cy.get('#form_fms_layer_owner').should('have.value', 'bromley');
64+
});
65+
4866
it('adds stopper for Crystal Palace Park', function() {
4967
cy.visit('http://bromley.localhost:3001/report/new?longitude=-0.064555&latitude=51.422382');
5068
cy.contains('transferred to the Crystal Palace Park Trust');

bin/fixmystreet.com/fixture

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,16 @@ if ($opt->test_fixtures) {
361361
variable => 'true',
362362
required => 'false',
363363
automated => 'hidden_field',
364-
});
364+
},
365+
{
366+
code => 'fms_layer_owner',
367+
datatype => 'string',
368+
order => 1,
369+
variable => 'true',
370+
required => 'false',
371+
automated => 'hidden_field',
372+
}
373+
);
365374
$child_cat->update;
366375

367376
$child_cat = FixMyStreet::DB->resultset("Contact")->find({

data/test-asset-layers.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ bromley:
140140
feature_id: 'FEATURE_ID'
141141
asset_category: ["Lamp Column Damaged", "Light Not Working", "Light On All Day", "Light blocked by vegetation"]
142142
asset_item: 'street light'
143+
select_action: true
144+
actions:
145+
asset_found: fixmystreet.assets.bromley.set_asset_owner
146+
asset_not_found: fixmystreet.assets.bromley.unset_asset_owner
143147
- wfs_feature: "PROW"
144148
stylemap: 'fixmystreet.assets.bromley.prow_stylemap'
145149
always_visible: true

perllib/FixMyStreet/Cobrand/Bromley.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ sub title_list {
154154
sub check_report_is_on_cobrand_asset {
155155
my $self = shift;
156156

157-
if ($self->{c}->get_param('feature_id') && $self->{c}->get_param('feature_id') =~ /A-48-24|A-48-26|A-48-27/) {
157+
if ($self->{c}->get_param('fms_layer_owner') && $self->{c}->get_param('fms_layer_owner') eq 'bromley') {
158158
return 1;
159159
} else {
160160
return 0;
@@ -284,7 +284,7 @@ sub open311_extra_data_include {
284284
}
285285

286286
sub open311_extra_data_exclude {
287-
[ 'feature_id', 'prow_reference' ]
287+
[ 'feature_id', 'prow_reference', 'fms_layer_owner' ]
288288
}
289289

290290
sub open311_config_updates {

t/Mock/MapIt.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ my @PLACES = (
5252
[ '?', 51.422382, -0.064555, 2482, 'Bromley Council', 'LBO' ],
5353
# National Sports Centre in Crystal Palace Park
5454
[ '?', 51.419275, -0.071410, 2482, 'Bromley Council', 'LBO' ],
55+
# On a light asset
56+
[ '?', 51.398387, 0.022775, 2482, 'Bromley Council', 'LBO' ],
5557
[ 'KT1 1AA', 51.408688, -0.304465, 2480, 'Kingston upon Thames Council', 'LBO' ],
5658
[ 'SM2 5HF', 51.354679, -0.183895, 2498, 'Sutton Borough Council', 'LBO' ],
5759
[ '?', 51.466707, 0.181108, 2494, 'London Borough of Bexley', 'LBO' ],

t/cobrand/bromley.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ my $streetlights = $mech->create_contact_ok(
5454
email => 'LIGHT',
5555
);
5656
$streetlights->set_extra_fields(
57-
{ code => 'feature_id', datatype => 'string', automated => 'hidden_field' },
57+
{ code => 'fms_layer_owner', datatype => 'string', automated => 'hidden_field' },
5858
);
5959
$streetlights->update;
6060

@@ -635,7 +635,7 @@ subtest 'Can select asset that is in Lewisham area on Bromley Cobrand' => sub {
635635
$mech->submit_form_ok( { with_fields => {
636636
title => 'Lamp issue in Lewisham on Bromley',
637637
detail => 'Lamp issue over the border',
638-
feature_id => 'A-48-24',
638+
fms_layer_owner => 'bromley',
639639
longitude => 0.005357,
640640
latitude => 51.418776,
641641
fms_extra_title => 'Mr'
@@ -658,7 +658,7 @@ subtest 'Can select asset that is in Lewisham area on FMS' => sub {
658658
$mech->submit_form_ok( { with_fields => {
659659
title => 'Lamp issue in Lewisham on FMS',
660660
detail => 'Lamp issue over the border',
661-
feature_id => 'A-48-26',
661+
fms_layer_owner => 'bromley',
662662
longitude => 0.005357,
663663
latitude => 51.418776,
664664
fms_extra_title => 'Mr'

web/cobrands/fixmystreet-uk-councils/assets.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,15 @@ fixmystreet.assets.bromley.not_found = function(layer) {
296296
fixmystreet.message_controller.road_found(layer);
297297
};
298298

299+
fixmystreet.assets.bromley.set_asset_owner = function() {
300+
$('#form_fms_layer_owner').val('bromley');
301+
};
302+
303+
fixmystreet.assets.bromley.unset_asset_owner = function() {
304+
$('#form_fms_layer_owner').val('');
305+
};
306+
307+
299308
/* Buckinghamshire */
300309

301310
fixmystreet.assets.buckinghamshire = {};

0 commit comments

Comments
 (0)