Skip to content

Commit

Permalink
[Peterborough] Remove cracked bin option from waste services
Browse files Browse the repository at this point in the history
No longer allow request for replacement bin with cracked bin
option.

https://mysocietysupport.freshdesk.com/a/tickets/3401
  • Loading branch information
MorayMySoc authored and dracos committed Oct 11, 2023
1 parent bd3289e commit 835dba0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 47 deletions.
25 changes: 3 additions & 22 deletions perllib/FixMyStreet/Cobrand/Peterborough.pm
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,6 @@ sub waste_munge_request_data {
my $reason = $data->{request_reason} || '';

$reason = {
cracked => "Cracked bin\n\nPlease remove cracked bin.",
lost_stolen => 'Lost/stolen bin',
new_build => 'New build',
other_staff => '(Other - PD STAFF)',
Expand Down Expand Up @@ -1134,17 +1133,9 @@ sub waste_munge_problem_data {

my $bin = $c->stash->{containers}{$container_id};
$data->{category} = $category;
if ($category_verbose =~ /cracked/) {
my $address = $c->stash->{property}->{address};
$data->{title} = "Request new $bin";
$data->{detail} = "Quantity: 1\n\n$address";
$data->{detail} .= "\n\nReason: Cracked bin\n\nPlease remove cracked bin.";
} else {
$data->{title} = $category =~ /Lid|Wheels/ ? "Damaged $bin bin" :
$category =~ /Not returned/ ? "Bin not returned" : $bin;
$data->{detail} = "$category_verbose\n\n" . $c->stash->{property}->{address};
}

$data->{title} = $category =~ /Lid|Wheels/ ? "Damaged $bin bin" :
$category =~ /Not returned/ ? "Bin not returned" : $bin;
$data->{detail} = "$category_verbose\n\n" . $c->stash->{property}->{address};

Check warning on line 1138 in perllib/FixMyStreet/Cobrand/Peterborough.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Peterborough.pm#L1138

Added line #L1138 was not covered by tests
if ( $data->{extra_detail} ) {
$data->{detail} .= "\n\nExtra detail: " . $data->{extra_detail};
}
Expand All @@ -1169,11 +1160,6 @@ sub waste_munge_problem_form_fields {
container_name => "Black bin",
label => "The bin’s wheels are damaged",
},
419 => {
container => 6533,
container_name => "Black bin",
label => "The bin is cracked",
},
537 => {
container => 6534,
container_name => "Green bin",
Expand All @@ -1184,11 +1170,6 @@ sub waste_munge_problem_form_fields {
container_name => "Green bin",
label => "The bin’s wheels are damaged",
},
420 => {
container => 6534,
container_name => "Green bin",
label => "The bin is cracked",
},
539 => {
container => 6579,
container_name => "Brown bin",
Expand Down
27 changes: 2 additions & 25 deletions t/app/controller/waste_peterborough.t
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ FixMyStreet::override_config {
$mech->log_in_ok($user->email);
$mech->get_ok('/waste/PE1 3NA:100090215480/request');
$mech->submit_form_ok({ with_fields => { 'container-425' => 1 }});
$mech->submit_form_ok({ with_fields => { 'request_reason' => 'cracked' }});
$mech->submit_form_ok({ with_fields => { 'request_reason' => 'lost_stolen' }});
$mech->submit_form_ok({ with_fields => { name => 'Bob Marge', email => $user->email }});
$mech->submit_form_ok({ with_fields => { process => 'summary' } });
$mech->content_contains('Request sent');
Expand All @@ -270,26 +270,10 @@ FixMyStreet::override_config {
$mech->content_contains('/waste/PE1%203NA:100090215480"');
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
is $report->get_extra_field_value('uprn'), 100090215480;
is $report->detail, "Quantity: 1\n\n1 Pope Way, Peterborough, PE1 3NA\n\nReason: Cracked bin\n\nPlease remove cracked bin.";
is $report->detail, "Quantity: 1\n\n1 Pope Way, Peterborough, PE1 3NA\n\nReason: Lost/stolen bin";
is $report->category, 'All bins';
is $report->title, 'Request new All bins';
};
subtest 'Report a cracked bin raises a bin delivery request' => sub {
$mech->get_ok('/waste/PE1 3NA:100090215480/problem');
$mech->submit_form_ok({ with_fields => { 'service-420' => 1 } });
$mech->submit_form_ok({ with_fields => { name => 'Bob Marge', email => $user->email }});
$mech->content_contains('The bin is cracked', "Cracked category found");
$mech->submit_form_ok({ with_fields => { process => 'summary' } });
$mech->content_contains('Damaged bin reported');
$mech->content_contains('Please leave your bin accessible');
$mech->content_contains('Show upcoming bin days');
$mech->content_contains('/waste/PE1%203NA:100090215480"');
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
is $report->get_extra_field_value('uprn'), 100090215480;
is $report->detail, "Quantity: 1\n\n1 Pope Way, Peterborough, PE1 3NA\n\nReason: Cracked bin\n\nPlease remove cracked bin.";
is $report->category, 'Green 240L bin';
is $report->title, 'Request new 240L Green';
};
subtest 'Staff-only request reason shown correctly' => sub {
$mech->get_ok('/waste/PE1 3NA:100090215480/request');
$mech->content_lacks("(Other - PD STAFF)");
Expand Down Expand Up @@ -455,13 +439,6 @@ FixMyStreet::override_config {
$b->mock('Premises_Attributes_Get', sub { [] });
};
subtest 'Report broken bin, already reported' => sub {
$b->mock('ServiceRequests_Get', sub { [
{ ServiceType => { ID => 419 }, ServiceStatus => { Status => "OPEN" } },
] });
$mech->get_ok('/waste/PE1 3NA:100090215480/problem');
$mech->content_like(qr/name="service-419" value="1"\s+disabled/);
$mech->content_like(qr/name="service-538" value="1"\s+disabled/);
$mech->content_like(qr/name="service-541" value="1"\s+disabled/);
$b->mock('ServiceRequests_Get', sub { [
{ ServiceType => { ID => 538 }, ServiceStatus => { Status => "OPEN" } },
] });
Expand Down

0 comments on commit 835dba0

Please sign in to comment.