Skip to content

Commit

Permalink
[SLWP] More nuanced container request titles.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Apr 8, 2024
1 parent 14b40e8 commit dae29aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 7 additions & 1 deletion perllib/FixMyStreet/Roles/CobrandSLWP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,13 @@ sub waste_munge_request_data {
$nice_reason = "Additional bag required";
}

$data->{title} = "Request new $container";
if ($reason eq 'damaged' || $reason eq 'missing') {
$data->{title} = "Request replacement $container";
} elsif ($reason eq 'change_capacity') {
$data->{title} = "Request exchange for $container";
} else {
$data->{title} = "Request new $container";
}
$data->{detail} = "Quantity: $quantity\n\n$address";
$data->{detail} .= "\n\nReason: $nice_reason" if $nice_reason;

Expand Down
8 changes: 4 additions & 4 deletions t/app/controller/waste_kingston_r.t
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ FixMyStreet::override_config {
is $report->get_extra_field_value('uprn'), 1000000002;
is $report->detail, "Quantity: 1\n\n2 Example Street, Kingston, KT1 1AA\n\nReason: My container is damaged - Damaged during collection";
is $report->category, 'Request new container';
is $report->title, 'Request new Blue lid paper and cardboard bin (240L)';
is $report->title, 'Request replacement Blue lid paper and cardboard bin (240L)';
FixMyStreet::Script::Reports::send();
my $req = Open311->test_req_used;
my $cgi = CGI::Simple->new($req->content);
Expand All @@ -134,7 +134,7 @@ FixMyStreet::override_config {
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
is $report->get_extra_field_value('uprn'), 1000000002;
is $report->detail, "Quantity: 2\n\n2 Example Street, Kingston, KT1 1AA\n\nReason: My container is missing - Were there, now not";
is $report->title, 'Request new Green recycling box (55L)';
is $report->title, 'Request replacement Green recycling box (55L)';
FixMyStreet::Script::Reports::send();
my $req = Open311->test_req_used;
my $cgi = CGI::Simple->new($req->content);
Expand Down Expand Up @@ -170,7 +170,7 @@ FixMyStreet::override_config {
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
is $report->get_extra_field_value('uprn'), 1000000002;
is $report->detail, "Quantity: 2\n\n2 Example Street, Kingston, KT1 1AA\n\nReason: My container is damaged - Wear and tear";
is $report->title, 'Request new Green recycling box (55L)';
is $report->title, 'Request replacement Green recycling box (55L)';
FixMyStreet::Script::Reports::send();
my $req = Open311->test_req_used;
my $cgi = CGI::Simple->new($req->content);
Expand Down Expand Up @@ -271,7 +271,7 @@ FixMyStreet::override_config {
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
is $report->get_extra_field_value('uprn'), 1000000002;
is $report->detail, "Quantity: 1\n\n2 Example Street, Kingston, KT1 1AA\n\nReason: My container is damaged - Other damage";
is $report->title, 'Request new Green recycling bin (240L)';
is $report->title, 'Request replacement Green recycling bin (240L)';
FixMyStreet::Script::Reports::send();
my $req = Open311->test_req_used;
my $cgi = CGI::Simple->new($req->content);
Expand Down
8 changes: 4 additions & 4 deletions t/app/controller/waste_sutton_r.t
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ FixMyStreet::override_config {
is $report->get_extra_field_value('uprn'), 1000000002;
is $report->detail, "Quantity: 1\n\n2 Example Street, Sutton, SM1 1AA\n\nReason: Damaged";
is $report->category, 'Request new container';
is $report->title, 'Request new Paper and Cardboard Green Wheelie Bin (240L)';
is $report->title, 'Request replacement Paper and Cardboard Green Wheelie Bin (240L)';
is $report->get_extra_field_value('payment'), 500, 'correct payment';
is $report->get_extra_field_value('payment_method'), 'credit_card', 'correct payment method on report';
is $report->get_extra_field_value('Container_Type'), 19, 'correct bin type';
Expand Down Expand Up @@ -172,7 +172,7 @@ FixMyStreet::override_config {
$mech->content_contains('Containers typically arrive within 20 working days');

is $report->get_extra_field_value('uprn'), 1000000002;
is $report->title, 'Request new Larger Brown General Waste Wheelie Bin (240L)';
is $report->title, 'Request exchange for Larger Brown General Waste Wheelie Bin (240L)';
is $report->get_extra_field_value('payment'), 1500, 'correct payment';
is $report->get_extra_field_value('Container_Type'), '1::2', 'correct bin type';
is $report->get_extra_field_value('Action'), '2::1', 'correct container request action';
Expand All @@ -197,7 +197,7 @@ FixMyStreet::override_config {
$mech->content_contains('Containers typically arrive within 20 working days');

is $report->get_extra_field_value('uprn'), 1000000002;
is $report->title, 'Request new Paper and Cardboard Green Wheelie Bin (240L)';
is $report->title, 'Request exchange for Paper and Cardboard Green Wheelie Bin (240L)';
is $report->get_extra_field_value('payment'), 1500, 'correct payment';
is $report->get_extra_field_value('Container_Type'), '36::19', 'correct bin type';
is $report->get_extra_field_value('Action'), '2::1', 'correct container request action';
Expand All @@ -215,7 +215,7 @@ FixMyStreet::override_config {
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
is $report->get_extra_field_value('uprn'), 1000000002;
is $report->detail, "Quantity: 1\n\n2 Example Street, Sutton, SM1 1AA\n\nReason: Missing";
is $report->title, 'Request new Mixed Recycling Green Box (55L)';
is $report->title, 'Request replacement Mixed Recycling Green Box (55L)';
};

subtest 'Report missed collection' => sub {
Expand Down

0 comments on commit dae29aa

Please sign in to comment.