From cc253c028c0a3a3710864f405e1da3571f8996c9 Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Thu, 30 May 2024 02:58:04 +0100 Subject: [PATCH 01/10] [Bexley][WW] Use USRN logs only --- perllib/FixMyStreet/Cobrand/Bexley/Waste.pm | 19 ++++++------------- t/app/controller/waste_bexley.t | 10 +--------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm b/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm index 3fc5330b129..0ef819036f4 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm @@ -492,23 +492,16 @@ sub _in_cab_logs { my $dt_from = $self->_subtract_working_days(WORKING_DAYS_WINDOW); my $cab_logs; if ( !$self->{c}->stash->{cab_logs} ) { - my $cab_logs_uprn = $self->whitespace->GetInCabLogsByUprn( - $property->{uprn}, - $dt_from->stringify, - ); - - my $cab_logs_usrn + # Property should always have a USRN, but return UPRN logs in case not + $cab_logs = $property->{usrn} ? $self->whitespace->GetInCabLogsByUsrn( $property->{usrn}, $dt_from->stringify, - ) : []; - - $cab_logs = [ @$cab_logs_uprn, @$cab_logs_usrn ]; - - # Make cab logs unique by LogID and Reason - my %seen; - @$cab_logs = grep { !$seen{ $_->{LogID} . $_->{Reason} }++ } @$cab_logs; + ) : $self->whitespace->GetInCabLogsByUprn( + $property->{uprn}, + $dt_from->stringify, + ); $self->{c}->stash->{cab_logs} = $cab_logs; } else { diff --git a/t/app/controller/waste_bexley.t b/t/app/controller/waste_bexley.t index 5d8c4c250d0..13b49230ab6 100644 --- a/t/app/controller/waste_bexley.t +++ b/t/app/controller/waste_bexley.t @@ -101,10 +101,6 @@ sub default_mocks { return _site_collections()->{$uprn}; } ); - $whitespace_mock->mock( 'GetInCabLogsByUprn', sub { - my ( $self, $uprn ) = @_; - return [ grep { $_->{Uprn} eq $uprn } @{ _in_cab_logs() } ]; - }); $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { my ( $self, $usrn ) = @_; return _in_cab_logs(); @@ -455,7 +451,6 @@ FixMyStreet::override_config { }, ]; } ); - $whitespace_mock->mock( 'GetInCabLogsByUprn', sub { [] } ); $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { [] } ); set_fixed_time('2024-04-01T07:00:00'); # April 1st, 08:00 BST @@ -488,7 +483,7 @@ FixMyStreet::override_config { $mech->content_contains('Collection completed or attempted earlier today'); note 'Property has red tag on collection attempted earlier today'; - $whitespace_mock->mock( 'GetInCabLogsByUprn', sub { + $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { return [ { LogID => 1, @@ -500,7 +495,6 @@ FixMyStreet::override_config { }, ]; }); - $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { [] } ); $mech->get_ok('/waste/10001'); $mech->content_contains('Service status'); $mech->content_contains( @@ -510,7 +504,6 @@ FixMyStreet::override_config { $mech->content_contains('Collection completed or attempted earlier today'); note 'Red tag on other property on same street'; - $whitespace_mock->mock( 'GetInCabLogsByUprn', sub { [] } ); $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { return [ { @@ -529,7 +522,6 @@ FixMyStreet::override_config { $mech->content_contains('Collection completed or attempted earlier today'); note 'Service update on street'; - $whitespace_mock->mock( 'GetInCabLogsByUprn', sub { [] } ); $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { return [ { From c3ec368edb7610f2c616327d33391d78d91329aa Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Fri, 31 May 2024 19:19:52 +0100 Subject: [PATCH 02/10] [Bexley][WW] Add different messaging for attempted vs successful collection today --- perllib/FixMyStreet/Cobrand/Bexley/Waste.pm | 30 +++++++++++---------- t/app/controller/waste_bexley.t | 19 ++++++++----- templates/web/base/waste/bin_days.html | 6 ++++- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm b/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm index 0ef819036f4..db53b2e58ab 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm @@ -209,9 +209,10 @@ sub bin_services_for_address { = $self->_missed_collection_reports($property); $property->{recent_collections} = $self->_recent_collections($property); - my ( $property_logs, $street_logs, $successful_collections ) + my ( $property_logs, $street_logs, $completed_or_attempted_collections ) = $self->_in_cab_logs($property); - $property->{successful_collections} = $successful_collections; + $property->{completed_or_attempted_collections} + = $completed_or_attempted_collections; $property->{red_tags} = $property_logs; $property->{service_updates} = $street_logs; @@ -265,10 +266,10 @@ sub bin_services_for_address { # 'Next collection date' could be today; successful collection logs # will tell us if the collection has already been made - my $successful_collection_dt - = $property->{successful_collections}{$round}; - my $collected_today = $successful_collection_dt - && $now_dt->delta_days($successful_collection_dt) + my $completed_or_attempted_collection_dt + = $property->{completed_or_attempted_collections}{$round}; + my $collected_today = $completed_or_attempted_collection_dt + && $now_dt->delta_days($completed_or_attempted_collection_dt) ->in_units('days') == 0 ? 1 : 0; @@ -510,9 +511,9 @@ sub _in_cab_logs { my @property_logs; my @street_logs; - my %successful_collections; + my %completed_or_attempted_collections; - return ( \@property_logs, \@street_logs, \%successful_collections ) + return ( \@property_logs, \@street_logs, \%completed_or_attempted_collections ) unless $cab_logs; for (@$cab_logs) { @@ -522,9 +523,9 @@ sub _in_cab_logs { # log against a round code should be taken as a sign that the round # has been completed or at least attempted for the property. # Overwrite entry for given round if a later logdate is found. - $successful_collections{ $_->{RoundCode} } = $logdate - if !$successful_collections{ $_->{RoundCode} } - || $successful_collections{ $_->{RoundCode} } < $logdate; + $completed_or_attempted_collections{ $_->{RoundCode} } = $logdate + if !$completed_or_attempted_collections{ $_->{RoundCode} } + || $completed_or_attempted_collections{ $_->{RoundCode} } < $logdate; # Gather property-level and street-level exceptions if ( $_->{Reason} && $_->{Reason} ne 'N/A' ) { @@ -547,7 +548,8 @@ sub _in_cab_logs { } } - return ( \@property_logs, \@street_logs, \%successful_collections ); + return ( \@property_logs, \@street_logs, + \%completed_or_attempted_collections ); } sub can_report_missed { @@ -573,14 +575,14 @@ sub can_report_missed { if ($last_expected_collection_dt) { # TODO We can probably get successful collections directly off the # property rather than query _in_cab_logs again - my ( undef, undef, $successful_collections ) + my ( undef, undef, $completed_or_attempted_collections ) = $self->_in_cab_logs($property); # If there is a log for this collection, that is when # the round was completed so we can make a report if # we're within that time my $logged_time_for_round - = $successful_collections->{ $service->{round} }; + = $completed_or_attempted_collections->{ $service->{round} }; # log time needs to be greater than or equal to 3 working days ago, # less than today diff --git a/t/app/controller/waste_bexley.t b/t/app/controller/waste_bexley.t index 13b49230ab6..213a6d80357 100644 --- a/t/app/controller/waste_bexley.t +++ b/t/app/controller/waste_bexley.t @@ -459,7 +459,8 @@ FixMyStreet::override_config { $mech->get_ok('/waste/10001'); $mech->content_lacks('Service status'); $mech->content_contains('Being collected today'); - $mech->content_lacks('Collection completed or attempted earlier today'); + $mech->content_lacks('Reported as collected today'); + $mech->content_lacks('Could not be collected today because it was red-tagged. See reason below.'); # Set time to later in the day set_fixed_time('2024-04-01T16:01:00'); # April 1st, 17:01 BST @@ -480,14 +481,15 @@ FixMyStreet::override_config { $mech->get_ok('/waste/10001'); $mech->content_lacks('Service status'); $mech->content_lacks('Being collected today'); - $mech->content_contains('Collection completed or attempted earlier today'); + $mech->content_contains('Reported as collected today'); + $mech->content_lacks('Could not be collected today because it was red-tagged. See reason below.'); note 'Property has red tag on collection attempted earlier today'; $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { return [ { LogID => 1, - Reason => 'Bin has gone feral', + Reason => 'Paper & Card - Bin has gone feral', RoundCode => 'RND-8-9', LogDate => '2024-04-01T12:00:00.417', Uprn => '10001', @@ -501,14 +503,15 @@ FixMyStreet::override_config { 'Our collection teams have reported the following problems with your bins:' ); $mech->content_lacks('Being collected today'); - $mech->content_contains('Collection completed or attempted earlier today'); + $mech->content_lacks('Reported as collected today'); + $mech->content_contains('Could not be collected today because it was red-tagged. See reason below.'); note 'Red tag on other property on same street'; $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { return [ { LogID => 1, - Reason => 'Bin has gone feral', + Reason => 'Paper & Card - Bin has gone feral', RoundCode => 'RND-8-9', LogDate => '2024-04-01T12:00:00.417', Uprn => '19991', @@ -519,7 +522,8 @@ FixMyStreet::override_config { $mech->get_ok('/waste/10001'); $mech->content_lacks('Service status'); $mech->content_lacks('Being collected today'); - $mech->content_contains('Collection completed or attempted earlier today'); + $mech->content_contains('Reported as collected today'); + $mech->content_lacks('Could not be collected today because it was red-tagged. See reason below.'); note 'Service update on street'; $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { @@ -541,7 +545,8 @@ FixMyStreet::override_config { 'Our collection teams have reported the following problems with your bins:' ); $mech->content_lacks('Being collected today'); - $mech->content_contains('Collection completed or attempted earlier today'); + $mech->content_contains('Reported as collected today'); + $mech->content_lacks('Could not be collected today because it was red-tagged. See reason below.'); # Reinstate original mocks set_fixed_time('2024-03-31T01:00:00'); # March 31st, 02:00 BST diff --git a/templates/web/base/waste/bin_days.html b/templates/web/base/waste/bin_days.html index a1f3c1a1a92..c97158f103e 100644 --- a/templates/web/base/waste/bin_days.html +++ b/templates/web/base/waste/bin_days.html @@ -121,7 +121,11 @@

Your subscription is soo
[% IF unit.next %] [% IF unit.next.already_collected %] - Collection completed or attempted earlier today + [% IF unit.report_locked_out %] + Could not be collected today because it was red-tagged. See reason below. + [% ELSE %] + Reported as collected today + [% END %] [% ELSIF unit.next.is_today %] Being collected today [% ELSE %] From 035bad6a2f23e0a53f54f002fad6e7c176eff9a6 Mon Sep 17 00:00:00 2001 From: Chris Mytton Date: Tue, 4 Jun 2024 06:48:55 +0100 Subject: [PATCH 03/10] [Bexley] Change "missed collections can only be reported..." text Make it clear that the 3 days is since the last actual, not scheduled collection. --- t/app/controller/waste_bexley.t | 11 +++++++++++ templates/web/bexley/waste/_service_missed.html | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/t/app/controller/waste_bexley.t b/t/app/controller/waste_bexley.t index 213a6d80357..0281cbd6ebd 100644 --- a/t/app/controller/waste_bexley.t +++ b/t/app/controller/waste_bexley.t @@ -449,6 +449,16 @@ FixMyStreet::override_config { RoundSchedule => 'RND-8-9 Mon, RND-8-9 Wed', }, + { SiteServiceID => 6, + ServiceItemDescription => 'Service 6', + ServiceItemName => 'RES-CHAM', # Residual Chamberlain + + NextCollectionDate => '2024-05-01T00:00:00', + SiteServiceValidFrom => '2024-03-31T00:59:59', + SiteServiceValidTo => '0001-01-01T00:00:00', + + RoundSchedule => 'RND-6 Wed Wk 2', + }, ]; } ); $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { [] } ); @@ -461,6 +471,7 @@ FixMyStreet::override_config { $mech->content_contains('Being collected today'); $mech->content_lacks('Reported as collected today'); $mech->content_lacks('Could not be collected today because it was red-tagged. See reason below.'); + $mech->content_contains('Please note that missed collections can only be reported within 3 working days of your last collection day'); # Set time to later in the day set_fixed_time('2024-04-01T16:01:00'); # April 1st, 17:01 BST diff --git a/templates/web/bexley/waste/_service_missed.html b/templates/web/bexley/waste/_service_missed.html index 80ac55cf3bb..9feadcc4905 100644 --- a/templates/web/bexley/waste/_service_missed.html +++ b/templates/web/bexley/waste/_service_missed.html @@ -19,5 +19,5 @@ [% ELSIF NOT no_default %] - Please note that missed collections can only be reported within 3 working days of your scheduled collection day. + Please note that missed collections can only be reported within 3 working days of your last collection day. [% END %] From 8664dc6f67d21102526e397ebcdfa5942b989fb9 Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Tue, 28 May 2024 16:03:27 +0100 Subject: [PATCH 04/10] [Camden] Sign post user elsewhere for housing repairs For FD-4208 --- templates/web/camden/report/new/roads_message.html | 7 +++++-- .../web/fixmystreet.com/report/new/roads_message.html | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/templates/web/camden/report/new/roads_message.html b/templates/web/camden/report/new/roads_message.html index 21c7eceb857..346454622d0 100644 --- a/templates/web/camden/report/new/roads_message.html +++ b/templates/web/camden/report/new/roads_message.html @@ -1,6 +1,9 @@