diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 3 | ||||
-rw-r--r-- | perllib/Integrations/Echo.pm | 5 | ||||
-rw-r--r-- | t/cobrand/bromley.t | 18 | ||||
-rw-r--r-- | templates/web/bromley/waste/enquiry-problem.html | 38 |
4 files changed, 52 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 8b6924f2d..24210e3d6 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -546,6 +546,7 @@ sub bin_services_for_address { request_open => $open_request, request_containers => $containers, request_max => $quantity_max{$_->{ServiceId}}, + enquiry_open_events => $open->{enquiry}, service_task_id => $servicetask->{Id}, service_task_name => $servicetask->{TaskTypeName}, service_task_type_id => $servicetask->{TaskTypeId}, @@ -585,6 +586,8 @@ sub _parse_open_events { } elsif (2095 <= $event_type && $event_type <= 2103) { # Missed collection my $report = $self->problems->search({ external_id => $_->{Guid} })->first; $open->{missed}->{$service_id} = $report ? { report => $report } : 1; + } else { # General enquiry of some sort + $open->{enquiry}->{$event_type} = 1; } } return $open; diff --git a/perllib/Integrations/Echo.pm b/perllib/Integrations/Echo.pm index 205e1178f..48a0edc6c 100644 --- a/perllib/Integrations/Echo.pm +++ b/perllib/Integrations/Echo.pm @@ -295,9 +295,12 @@ sub GetEventsForObject { my ($self, $id, $type) = @_; my $from = DateTime->now->set_time_zone(FixMyStreet->local_time_zone)->subtract(months => 3); return [ { - # Missed collection for service 542 + # Missed collection for service 542 (food waste) EventTypeId => 2100, ServiceId => 542, + }, { # And a gate not closed + EventTypeId => 2118, + ServiceId => 542, }, { # Request for a new paper container EventTypeId => 2104, diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t index 045fdd56d..b31908f7d 100644 --- a/t/cobrand/bromley.t +++ b/t/cobrand/bromley.t @@ -1,5 +1,6 @@ use CGI::Simple; use Test::MockModule; +use Test::MockTime qw(:all); use FixMyStreet::TestMech; use FixMyStreet::Script::Reports; my $mech = FixMyStreet::TestMech->new; @@ -252,6 +253,23 @@ subtest 'check heatmap page' => sub { }; }; +subtest 'test open enquiries' => sub { + set_fixed_time('2020-05-19T12:00:00Z'); # After sample food waste collection + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'bromley', + COBRAND_FEATURES => { + echo => { bromley => { sample_data => 1 } }, + waste => { bromley => 1 } + }, + }, sub { + $mech->get_ok('/waste/uprn/12345'); + $mech->follow_link_ok({ text => 'Report a problem with a food waste collection' }); + $mech->content_contains('Waste spillage'); + $mech->content_lacks('Gate not closed'); + }; + +}; + subtest 'test waste max-per-day' => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => 'bromley', diff --git a/templates/web/bromley/waste/enquiry-problem.html b/templates/web/bromley/waste/enquiry-problem.html index 948cb91f3..db4cb1848 100644 --- a/templates/web/bromley/waste/enquiry-problem.html +++ b/templates/web/bromley/waste/enquiry-problem.html @@ -1,13 +1,29 @@ -[% PROCESS waste/enquiry.html +[% + +f = []; +service_id = c.req.params.service_id; +service = services.$service_id; +IF service.report_allowed; + IF !service.enquiry_open_events.2118; + f.push( { value = 'Gate not closed', label = 'A gate or enclosure wasn’t closed after the collection' } ); + END; + IF !service.enquiry_open_events.2119; + f.push( { value = 'Waste spillage', label = 'Bin contents were spilled during the collection' } ); + END; + IF !service.enquiry_open_events.2120; + f.push( { value = 'Bin not returned', label = 'A bin wasn’t returned after the collection' } ); + END; +END; +f.push( + { value = 'Crew behaviour', label = 'There was a problem with the crew’s behaviour' }, + { value = 'Wrongful removal', label = 'Something was wrongly removed during the collection' }, + { value = 'Damage to 3rd party', label = 'Someone else’s vehicle was damaged' }, + { value = 'Damage to Property', label = 'My property was damaged' }, + { value = 'Failure to deliver bin', label = 'My bin was not delivered' }, +); + +PROCESS waste/enquiry.html title = 'Report a problem' - field_options = [ - { value = 'Gate not closed', label = 'A gate or enclosure wasn’t closed after the collection' }, - { value = 'Waste spillage', label = 'Bin contents were spilled during the collection' }, - { value = 'Bin not returned', label = 'A bin wasn’t returned after the collection' }, - { value = 'Crew behaviour', label = 'There was a problem with the crew’s behaviour' }, - { value = 'Wrongful removal', label = 'Something was wrongly removed during the collection' }, - { value = 'Damage to 3rd party', label = 'Someone else’s vehicle was damaged' }, - { value = 'Damage to Property', label = 'My property was damaged' }, - { value = 'Failure to deliver bin', label = 'My bin was not delivered' }, - ] + field_options = f; + %] |