Skip to content

Commit

Permalink
[Bromley] Treat some enquiries same as missed.
Browse files Browse the repository at this point in the history
In terms of within-two-day and no existing open event.
  • Loading branch information
dracos committed Jun 29, 2020
1 parent f9eeacf commit b4573b3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
3 changes: 3 additions & 0 deletions perllib/FixMyStreet/Cobrand/Bromley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,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},
Expand Down Expand Up @@ -580,6 +581,8 @@ sub _parse_events {
$open->{request}->{$container} = 1;
} elsif (2095 <= $event_type && $event_type <= 2103) { # Missed collection
$open->{missed}->{$service_id} = 1;
} else { # General enquiry of some sort
$open->{enquiry}->{$event_type} = 1;
}
}
return $open;
Expand Down
5 changes: 4 additions & 1 deletion perllib/Integrations/Echo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,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,
Expand Down
18 changes: 18 additions & 0 deletions t/cobrand/bromley.t
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -251,6 +252,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',
Expand Down
32 changes: 24 additions & 8 deletions templates/web/bromley/waste/enquiry-problem.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
[% 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' },
);

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' },
]
field_options = f;

%]

0 comments on commit b4573b3

Please sign in to comment.