Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial notts police cobrand set up. #4983

Closed
wants to merge 10 commits into from
49 changes: 22 additions & 27 deletions perllib/FixMyStreet/Cobrand/Bexley/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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' ) {
Expand All @@ -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 {
Expand All @@ -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
Expand Down
63 changes: 63 additions & 0 deletions perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm
Original file line number Diff line number Diff line change
@@ -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' }

Check warning on line 28 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L25-L28

Added lines #L25 - L28 were not covered by tests

sub disambiguate_location {
my $self = shift;
my $string = shift;

Check warning on line 32 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L31-L32

Added lines #L31 - L32 were not covered by tests

my $town = "Nottinghamshire";

Check warning on line 34 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L34

Added line #L34 was not covered by tests

return {
%{ $self->SUPER::disambiguate_location() },

Check warning on line 37 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L37

Added line #L37 was not covered by tests
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' }

Check warning on line 45 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L45

Added line #L45 was not covered by tests

sub privacy_policy_url {
'https://www.nottinghamshire.pcc.police.uk/Document-Library/Public-Information/Policies-and-Procedures/People/Privacy-Notice-OPCCN-Feb-2023.pdf'

Check warning on line 48 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L48

Added line #L48 was not covered by tests
}

=item * Never allows anonymous reports.

=cut

sub allow_anonymous_reports { 0 }

Check warning on line 55 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L55

Added line #L55 was not covered by tests

=item * Users with a notts.police.uk email can always be found in the admin.

=cut

sub admin_user_domain { 'notts.police.uk' }

Check warning on line 61 in perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/NottinghamshirePolice.pm#L61

Added line #L61 was not covered by tests

1;
40 changes: 24 additions & 16 deletions t/app/controller/waste_bexley.t
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -485,37 +492,37 @@ 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',
Usrn => '321',
},
];
});
$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',
Expand All @@ -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 [
{
Expand All @@ -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
Expand Down
21 changes: 21 additions & 0 deletions templates/email/nottinghamshirepolice/_email_color_overrides.html
Original file line number Diff line number Diff line change
@@ -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

%]
6 changes: 5 additions & 1 deletion templates/web/base/waste/bin_days.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ <h3 class="govuk-heading-l govuk-warning-text__heading">Your subscription is soo
<dd class="govuk-summary-list__value">
[% IF unit.next %]
[% IF unit.next.already_collected %]
<strong>Collection completed or attempted earlier today</strong>
[% IF unit.report_locked_out %]
<strong>Could not be collected today because it was red-tagged. See reason below.</strong>
[% ELSE %]
<strong>Reported as collected today</strong>
[% END %]
[% ELSIF unit.next.is_today %]
<strong>Being collected today</strong>
[% ELSE %]
Expand Down
2 changes: 1 addition & 1 deletion templates/web/bexley/waste/_service_missed.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
<input type="submit" value="Report a [% unit.service_name FILTER lower %] collection as missed" class="waste-service-descriptor waste-service-link">
</form>
[% ELSIF NOT no_default %]
<span class="waste-service-descriptor">Please note that missed collections can only be reported within 3 working days of your scheduled collection day.</span>
<span class="waste-service-descriptor">Please note that missed collections can only be reported within 3 working days of your last collection day.</span>
[% END %]
7 changes: 5 additions & 2 deletions templates/web/camden/report/new/roads_message.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div id="js-camden-housing-estate-restriction" class="js-responsibility-message hidden">
<strong>Not maintained by Camden Council</strong>
<p>The location you have selected is not maintained by Camden Council.</p>
<strong>Report a housing repair</strong>
<p>The location you have chosen is on a Camden housing estate and is the responsibility of housing repairs.
Please use <a href="https://www.camden.gov.uk/report-a-housing-repair">this link</a> to continue to the Camden housing repairs service,
to raise the issue directly with them.</p>
<p>For an expedited response please use the chat functionality available on that page.</p>
</div>

<div id="js-not-a-road" class="hidden js-responsibility-message js-roads-camden">
Expand Down
7 changes: 5 additions & 2 deletions templates/web/fixmystreet.com/report/new/roads_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
<p>There is no council car park in the area selected.</p>
</div>
<div id="js-camden-housing-estate-restriction" class="js-responsibility-message hidden">
<strong>Not maintained by Camden Council</strong>
<p>The location you have selected is not maintained by Camden Council.</p>
<strong>Report a housing repair</strong>
<p>The location you have chosen is on a Camden housing estate and is the responsibility of housing repairs.
Please use <a href="https://www.camden.gov.uk/report-a-housing-repair">this link</a> to continue to the Camden housing repairs service,
to raise the issue directly with them.</p>
<p>For an expedited response please use the chat functionality available on that page.</p>
</div>
</div>
<div id="js-environment-message" class="hidden">
Expand Down
11 changes: 11 additions & 0 deletions templates/web/nottinghamshirepolice/front/post-steps.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="border-wrapper">
<h2>Antisocial Behaviour Immediate Justice Scheme
</h2>
<p>Nottinghamshire OPCC is one of 16 other PCC areas which has been selected to pilot the ASB Immediate Justice projects. The scheme will provide an opportunity for those who commit low level antisocial behaviour to compensate the community by undertaking supervised reparation activities which help to improve the environment e.g., litter picking, graffiti removal. Offenders will be offered these placements as an alternative to prosecution or current disposals methods which may only mean a verbal or written caution. In this way offenders will payback to the community for their offence which hopefully will provide victims with a sense that justice has been served.
</p>

<p>As part of the pilot, the PCC is keen to engage with the communities to give victims, residents, workers and visitors a say in what visible reparation activities they like see undertaken by ASB Offenders. In addition, an opportunity for them to identify suitable locations where they would like to see such activities take place. This website is where this can happen.</p>

<p>The type of activities offenders can undertake is fairly limited, and the locations you identify may not be suitable, but we will pass on your referral to the relevant local authority if the work is assessed as unsuitable. We will keep you informed of the outcome.
</p>
</div>
24 changes: 24 additions & 0 deletions web/cobrands/nottinghamshirepolice/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* COLOURS */

$black: #000;
$notts_police_blue: #039;
$primary: $notts_police_blue;
$primary_b: #222;
$primary_text: #222;

$base_bg: #fff;
$base_fg: #222;

/* NAVBAR */

$nav_colour: $primary_text;
$nav_background_colour: $primary;
$nav_hover_background_colour: $primary_b;

/* OTHER VARIABLES */

$col_click_map: $primary;

$front-main-color: #fff;
$form-hint-color: #222;
$front-main-color-desktop: #222;
Loading
Loading