Skip to content

Commit

Permalink
[Kingston] Fix issue requesting green bin and no box.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Nov 19, 2024
1 parent 0f5aa3e commit b6e332e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions perllib/FixMyStreet/Cobrand/Kingston.pm
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ sub waste_munge_request_form_pages {
}
}
# Both types of recycling container always
if ($data->{'container-' . CONTAINER_RECYCLING_BIN}) {
if ($data->{'container-' . CONTAINER_RECYCLING_BIN} && $fields->{"removal-" . CONTAINER_RECYCLING_BOX}) {
delete $fields->{"removal-" . CONTAINER_RECYCLING_BOX}{widget};
delete $fields->{"removal-" . CONTAINER_RECYCLING_BOX}{required};
}
if ($data->{'container-' . CONTAINER_RECYCLING_BOX}) {
if ($data->{'container-' . CONTAINER_RECYCLING_BOX} && $fields->{"removal-" . CONTAINER_RECYCLING_BIN}) {
delete $fields->{"removal-" . CONTAINER_RECYCLING_BIN}{widget};
delete $fields->{"removal-" . CONTAINER_RECYCLING_BIN}{required};
}
Expand Down
9 changes: 9 additions & 0 deletions t/app/controller/waste_kingston_r.t
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ FixMyStreet::override_config {
$mech->content_contains('Report a non-recyclable refuse collection as missed');
$e->mock('GetTasks', sub { [] });
};

foreach (
{ id => 19, name => 'Blue lid paper and cardboard bin (240L)' },
{ id => 16, name => 'Green recycling box (55L)' },
Expand Down Expand Up @@ -168,6 +169,14 @@ FixMyStreet::override_config {
};
}

subtest "Request a new green bin when you do not have a box" => sub {
# Switch the one 16 entry to a 12
$bin_data->[0]{ServiceTasks}{ServiceTask}[3]{Data}{ExtensibleDatum}{ChildData}{ExtensibleDatum}[0]{Value} = '12';
$mech->get_ok('/waste/12345/request');
$mech->submit_form_ok({ with_fields => { 'container-12' => 1, 'quantity-12' => 1 }});
$bin_data->[0]{ServiceTasks}{ServiceTask}[3]{Data}{ExtensibleDatum}{ChildData}{ExtensibleDatum}[0]{Value} = '16';
};

subtest 'Request new containers' => sub {
$mech->get_ok('/waste/12345/request');
# Missing 2, Damaged 19, Damaged+missing 16, two missing 24
Expand Down

0 comments on commit b6e332e

Please sign in to comment.