Skip to content

Commit

Permalink
[Brent] Do not refer clear sacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Jul 2, 2024
1 parent eba9449 commit 9e18f67
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions perllib/FixMyStreet/App/Form/Waste/Request/Brent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ has_field request_reason => (

my $choice = $saved_data->{'container-choice'};
my $months = $value eq 'new_build' ? $new_build_ordered_months{$choice} : $ordered_months{$choice};
return unless $months;

my $events = $echo->GetEventsForObject(PointAddress => $c->stash->{property}{id}, 2936, $months);
$events = $c->cobrand->_parse_events($events, { include_closed_requests => 1 });
$saved_data->{ordered_previously} = $events->{request}{$choice} ? 1 : 0;
Expand Down
11 changes: 11 additions & 0 deletions t/cobrand/brent.t
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,16 @@ FixMyStreet::override_config {
}, ]
});
subtest 'test requesting a sack' => sub {
# Ordered previously, but not referred
$echo->mock('GetEventsForObject', sub { [ {
Guid => 'a-guid',
EventTypeId => 2936,
ResolvedDate => { DateTime => '2024-05-17T12:00:00Z' },
Data => { ExtensibleDatum => { ChildData => { ExtensibleDatum => {
DatatypeName => 'Container Type',
Value => 8,
} } } },
} ] } );
$mech->get_ok('/waste/12345');
$mech->follow_link_ok({url => 'http://brent.fixmystreet.com/waste/12345/request'});
$mech->submit_form_ok({ with_fields => { 'container-choice' => 8 } }, "Choose sack");
Expand All @@ -1417,6 +1427,7 @@ FixMyStreet::override_config {
is $report->get_extra_field_value('Container_Request_Notes'), '';
is $report->get_extra_field_value('Container_Request_Quantity'), '1';
is $report->get_extra_field_value('service_id'), '269';
is $report->get_extra_field_value('request_referral'), '';
};
$echo->mock('GetServiceUnitsForObject' => sub {
return [
Expand Down

0 comments on commit 9e18f67

Please sign in to comment.