From 835dba084834eb8b3727ecd921decfab846066c3 Mon Sep 17 00:00:00 2001 From: Moray Jones Date: Fri, 22 Sep 2023 16:37:28 +0100 Subject: [PATCH] [Peterborough] Remove cracked bin option from waste services No longer allow request for replacement bin with cracked bin option. https://mysocietysupport.freshdesk.com/a/tickets/3401 --- perllib/FixMyStreet/Cobrand/Peterborough.pm | 25 +++---------------- t/app/controller/waste_peterborough.t | 27 ++------------------- 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm index dff5b635d9c..ed55703e748 100644 --- a/perllib/FixMyStreet/Cobrand/Peterborough.pm +++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm @@ -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)', @@ -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}; if ( $data->{extra_detail} ) { $data->{detail} .= "\n\nExtra detail: " . $data->{extra_detail}; } @@ -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", @@ -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", diff --git a/t/app/controller/waste_peterborough.t b/t/app/controller/waste_peterborough.t index 9c2a35a43a1..45c19633622 100644 --- a/t/app/controller/waste_peterborough.t +++ b/t/app/controller/waste_peterborough.t @@ -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'); @@ -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)"); @@ -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" } }, ] });