Skip to content

Commit

Permalink
[Bulky] Mark cancelled reports as cancelled.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Nov 13, 2024
1 parent e992502 commit 5d533bf
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Cobrand/Brent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ sub bulky_open_overdue {
sub _bulky_collection_overdue {
my $collection_due_date = $_[1]->{date};

$collection_due_date->add(days => 1)->truncate(to => 'day');
$collection_due_date = $collection_due_date->clone->add(days => 1)->truncate(to => 'day');
my $today = DateTime->now->set_time_zone($collection_due_date->time_zone);

return $today > $collection_due_date;
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Cobrand/Bromley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ sub cancel_bulky_collections_without_payment {
user_id => $self->body->comment_user_id,
extra => { bulky_cancellation => 1 },
});
$report->state('closed');
$report->state('cancelled');
$report->detail(
$report->detail . " | Cancelled since payment was not made in time"
);
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/DB/Result/Problem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ sub bulky_add_payment_confirmation_update {
sub bulky_cancel_collection {
my ($self, $type, $non_user_cancel) = @_;

$self->state('closed');
$self->state('cancelled');
my $description = $non_user_cancel
? "Cancelled" : $type eq 'amendment' ? 'Cancelled due to amendment' : "Cancelled at user request";
$self->detail($self->detail . " | " . $description);
Expand Down
4 changes: 2 additions & 2 deletions t/app/controller/waste_brent_small_items.t
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ FixMyStreet::override_config {
$mech->content_lacks('Cancel booking');

$report->discard_changes;
is $report->state, 'closed', 'Original report closed';
is $report->state, 'cancelled', 'Original report cancelled';
like $report->detail, qr/Cancelled at user request/, 'Original report detail field updated';

subtest 'Viewing original report summary after cancellation' => sub {
Expand All @@ -458,7 +458,7 @@ FixMyStreet::override_config {

subtest 'Missed collections' => sub {
my $report_id = $report->id;
$report->update({ external_id => 'a-guid' });
$report->update({ external_id => 'a-guid', state => 'confirmed' }); # Cancelled can't be reported

# Fixed date still set to 25th June
$mech->get_ok('/waste/12345');
Expand Down
4 changes: 2 additions & 2 deletions t/app/controller/waste_bromley_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ FixMyStreet::override_config {
$p->update;
$cobrand->cancel_bulky_collections_without_payment({ commit => 1 });
$p->discard_changes;
is $p->state, "closed";
is $p->state, "cancelled";
my $cancellation_update = $p->comments->first;
is $cancellation_update->text, "Booking cancelled since payment was not made in time";
is $cancellation_update->get_extra_metadata('bulky_cancellation'), 1;
Expand All @@ -775,7 +775,7 @@ FixMyStreet::override_config {
$mech->submit_form_ok({ with_fields => { payment_failed => 1 } });
$mech->content_contains('Payment Failed');
$report->discard_changes;
is $report->state, 'closed', "report cancelled after staff marked as payment failed";
is $report->state, 'cancelled', "report cancelled after staff marked as payment failed";
my $cancellation_update = $report->comments->first;
is $cancellation_update->text, "Booking cancelled";
is $cancellation_update->get_extra_metadata('bulky_cancellation'), 1;
Expand Down
2 changes: 1 addition & 1 deletion t/app/controller/waste_kands_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ FixMyStreet::override_config {
$mech->content_lacks('Cancel booking');

$report->discard_changes;
is $report->state, 'closed', 'Original report closed';
is $report->state, 'cancelled', 'Original report cancelled';
like $report->detail, qr/Cancelled at user request/, 'Original report detail field updated';

subtest 'Viewing original report summary after cancellation' => sub {
Expand Down
6 changes: 3 additions & 3 deletions t/app/controller/waste_merton_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ FixMyStreet::override_config {
$mech->content_contains('This collection has been cancelled');
$mech->content_contains('Booking cancelled due to amendment');
$report->discard_changes;
is $report->state, 'closed';
is $report->state, 'cancelled';
};

$report = $new_report;
Expand Down Expand Up @@ -790,7 +790,7 @@ FixMyStreet::override_config {
$mech->content_contains('This collection has been cancelled');
$mech->content_contains('Booking cancelled due to amendment');
$report->discard_changes;
is $report->state, 'closed';
is $report->state, 'cancelled';
};

$report = $new_report;
Expand Down Expand Up @@ -905,7 +905,7 @@ FixMyStreet::override_config {
$mech->content_lacks('Cancel booking');

$report->discard_changes;
is $report->state, 'closed', 'Original report closed';
is $report->state, 'cancelled', 'Original report cancelled';
like $report->detail, qr/Cancelled at user request/, 'Original report detail field updated';

subtest 'Viewing original report summary after cancellation' => sub {
Expand Down
4 changes: 2 additions & 2 deletions t/app/controller/waste_peterborough_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ FixMyStreet::override_config {
my $cancellation_report;
subtest 'reports' => sub {
$report->discard_changes;
is $report->state, 'closed', 'Original report closed';
is $report->state, 'cancelled', 'Original report cancelled';
like $report->detail, qr/Cancelled at user request/,
'Original report detail field updated';

Expand Down Expand Up @@ -1445,7 +1445,7 @@ FixMyStreet::override_config {
$mech->email_count_is(0);

$report->discard_changes;
is $report->state, 'closed', 'Original report closed';
is $report->state, 'cancelled', 'Original report cancelled';

my $cancellation_report
= FixMyStreet::DB->resultset('Problem')->find(
Expand Down

0 comments on commit 5d533bf

Please sign in to comment.