diff --git a/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm b/perllib/FixMyStreet/Cobrand/Bexley/Waste.pm index 3fc5330b129..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; @@ -492,23 +493,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 { @@ -517,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) { @@ -529,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' ) { @@ -554,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 { @@ -580,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/perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm b/perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm new file mode 100644 index 00000000000..1b9e317ad8c --- /dev/null +++ b/perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm @@ -0,0 +1,63 @@ +=head1 NAME + +FixMyStreet::Cobrand::NottinghamshirePolice - code specific to the Nottinghamshire Police cobrand. + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=cut + +package FixMyStreet::Cobrand::NottinghamshirePolice; +use base 'FixMyStreet::Cobrand::UKCouncils'; + +use strict; +use warnings; + +use Moo; + +=head2 Defaults + +=over 4 + +=cut + +sub council_area_id { 2236 } +sub council_area { 'Nottinghamshire'; } +sub council_name { 'Nottinghamshire Police' } +sub council_url { 'nottinghamshirepolice' } + +sub disambiguate_location { + my $self = shift; + my $string = shift; + + my $town = "Nottinghamshire"; + + return { + %{ $self->SUPER::disambiguate_location() }, + town => $town, + centre => '53.1337083457641,-1.00642123965732', + span => '0.713104976883301,0.678328244170235', + bounds => [ 52.7894115139395, -1.34459045070673, 53.5025164908228, -0.666262206536495 ], + }; +} + +sub enter_postcode_text { 'Enter a Nottinghamshire postcode, street name or area' } + +sub privacy_policy_url { + 'https://www.nottinghamshire.pcc.police.uk/Document-Library/Public-Information/Policies-and-Procedures/People/Privacy-Notice-OPCCN-Feb-2023.pdf' +} + +=item * Never allows anonymous reports. + +=cut + +sub allow_anonymous_reports { 0 } + +=item * Users with a notts.police.uk email can always be found in the admin. + +=cut + +sub admin_user_domain { 'notts.police.uk' } + +1; diff --git a/t/app/controller/waste_bexley.t b/t/app/controller/waste_bexley.t index 5d8c4c250d0..0281cbd6ebd 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(); @@ -453,9 +449,18 @@ 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( 'GetInCabLogsByUprn', sub { [] } ); $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { [] } ); set_fixed_time('2024-04-01T07:00:00'); # April 1st, 08:00 BST @@ -464,7 +469,9 @@ 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.'); + $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 @@ -485,14 +492,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( 'GetInCabLogsByUprn', sub { + $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', @@ -500,22 +508,21 @@ FixMyStreet::override_config { }, ]; }); - $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { [] } ); $mech->get_ok('/waste/10001'); $mech->content_contains('Service status'); $mech->content_contains( '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( 'GetInCabLogsByUprn', sub { [] } ); $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', @@ -526,10 +533,10 @@ 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( 'GetInCabLogsByUprn', sub { [] } ); $whitespace_mock->mock( 'GetInCabLogsByUsrn', sub { return [ { @@ -549,7 +556,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/email/nottinghamshirepolice/_email_color_overrides.html b/templates/email/nottinghamshirepolice/_email_color_overrides.html new file mode 100644 index 00000000000..854eecdf943 --- /dev/null +++ b/templates/email/nottinghamshirepolice/_email_color_overrides.html @@ -0,0 +1,21 @@ +[% + +blue = '#385889' +blue_pale = '#bec7d6' + +body_background_color = blue_pale +body_text_color = color_black + +header_background_color = color_white +header_text_color = color_white + +secondary_column_background_color = color_white + +button_background_color = blue +button_text_color = color_white + +logo_file = 'logo.png' +logo_width = "220" # pixel measurement, but without 'px' suffix +logo_height = "74" # pixel measurement, but without 'px' suffix + +%] 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 %] 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 %] 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 @@