Skip to content

Commit

Permalink
[Waste] Move request timeframe to configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Jul 4, 2023
1 parent 6f6afe6 commit 6723ebe
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 23 deletions.
5 changes: 0 additions & 5 deletions perllib/FixMyStreet/Cobrand/Peterborough.pm
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,6 @@ Functions specific to the waste product & Bartec integration.
=cut

has wasteworks_config => (
is => 'lazy',
default => sub { $_[0]->body->get_extra_metadata( 'wasteworks_config', {} ) },
);

sub _premises_for_postcode {
my $self = shift;
my $pc = shift;
Expand Down
15 changes: 12 additions & 3 deletions perllib/FixMyStreet/Cobrand/UKCouncils.pm
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package FixMyStreet::Cobrand::UKCouncils;
use parent 'FixMyStreet::Cobrand::UK';

use strict;
use warnings;

use Moo;
use Carp;
use List::Util qw(min max);
use URI::Escape;
Expand Down Expand Up @@ -422,6 +420,17 @@ sub munge_report_new_contacts {
}
}

=item wasteworks_config
Returns any database-stored WasteWorks configuration.
=cut

has wasteworks_config => (
is => 'lazy',
default => sub { $_[0]->body->get_extra_metadata( 'wasteworks_config', {} ) },
);

sub open311_extra_data {
my $self = shift;
my $include = $self->call_hook(open311_extra_data_include => @_);
Expand Down
6 changes: 5 additions & 1 deletion t/app/controller/waste.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ END { FixMyStreet::App->log->enable('info'); }

my $mech = FixMyStreet::TestMech->new;

my $body = $mech->create_body_ok(2482, 'Bromley Council', {}, { cobrand => 'bromley' });
my $body = $mech->create_body_ok(2482, 'Bromley Council', {}, {
cobrand => 'bromley',
wasteworks_config => { request_timeframe => "two weeks" }
});
my $user = $mech->create_user_ok('[email protected]', name => 'Normal User');
$user->update({ phone => "07123 456789" });
my $nameless_user = $mech->create_user_ok('[email protected]', name => '');
Expand Down Expand Up @@ -248,6 +251,7 @@ FixMyStreet::override_config {
$mech->content_contains($user->email);
$mech->submit_form_ok({ with_fields => { process => 'summary' } });
$mech->content_contains('Your container request has been sent');
$mech->content_contains('Containers typically arrive within two weeks,');
$mech->content_contains('Show upcoming bin days');
$mech->content_contains('/waste/12345"');
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
Expand Down
9 changes: 8 additions & 1 deletion t/app/controller/waste_sutton_r.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ my $params = {
jurisdiction => 'home',
can_be_devolved => 1,
};
my $body = $mech->create_body_ok(2498, 'Sutton Council', $params, { cobrand => 'sutton' });
my $body = $mech->create_body_ok(2498, 'Sutton Council', $params, {
cobrand => 'sutton',
wasteworks_config => { request_timeframe => '20 working days' }
});
my $kingston = $mech->create_body_ok(2480, 'Kingston Council', $params, { cobrand => 'kingston' });
my $user = $mech->create_user_ok('[email protected]', name => 'Normal User');
my $staff = $mech->create_user_ok('[email protected]', name => 'Staff User', from_body => $kingston->id);
Expand Down Expand Up @@ -107,11 +110,15 @@ FixMyStreet::override_config {
$mech->submit_form_ok({ with_fields => { name => 'Bob Marge', email => $user->email }});
$mech->submit_form_ok({ with_fields => { process => 'summary' } });
$mech->content_contains('request has been sent');
$mech->content_contains('Containers typically arrive within 20 working days');
my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first;
is $report->get_extra_field_value('uprn'), 1000000002;
is $report->detail, "Quantity: 1\n\n2 Example Street, Sutton, SM1 1AA\n\nReason: Damaged";
is $report->category, 'Request new container';
is $report->title, 'Request new Green paper and cardboard bin';
FixMyStreet::Script::Reports::send();
my $email = $mech->get_text_body_from_email;
like $email, qr/please allow up to 20 working days/;
};
subtest 'Report a new recycling raises a bin delivery request' => sub {
$mech->log_in_ok($user->email);
Expand Down
4 changes: 2 additions & 2 deletions templates/email/kingston/other-reported.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ <h1 style="[% h1_style %]">Your report has been&nbsp;logged</h1>
<p style="[% p_style %]">We will arrange another collection as soon as possible
in the next 2 working days (not including Saturday and Sunday).</p>
[% ELSIF report.category == 'Request new container' %]
<p style="[% p_style %]">We aim to deliver this container to you within 20
working days. If you have requested a replacement bin please leave your
<p style="[% p_style %]">We aim to deliver this container to you within [% cobrand.wasteworks_config.request_timeframe %].
If you have requested a replacement bin please leave your
broken one available for collection at the front of your property.</p>
[% END %]

Expand Down
2 changes: 1 addition & 1 deletion templates/email/kingston/other-reported.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Dear [% report.name %],
We will arrange another collection as soon as possible in the next 2
working days (not including Saturday and Sunday).
[% ELSIF report.category == 'Request new container' %]
We aim to deliver this container to you within 20 working days. If
We aim to deliver this container to you within [% cobrand.wasteworks_config.request_timeframe %]. If
you have requested a replacement bin please leave your broken one
available for collection at the front of your property.
[% END %]
Expand Down
5 changes: 3 additions & 2 deletions templates/email/sutton/other-reported.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ <h1 style="[% h1_style %]">Your report has been&nbsp;logged</h1>
[% INCLUDE '_council_reference.html' problem=report %]

[% IF report.category == 'Request new container' %]
<p style="[% p_style %]">Due to the current high demand, please allow up to 40
working days for this order to be processed. We thank you for your patience and
<p style="[% p_style %]">Due to the current high demand, please allow up to
[% cobrand.wasteworks_config.request_timeframe %]
for this order to be processed. We thank you for your patience and
understanding in advance.</p>
[% END %]

Expand Down
3 changes: 2 additions & 1 deletion templates/email/sutton/other-reported.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Your report to [% report.body %] has been logged on [% site_name %].
[% INCLUDE '_council_reference.txt' problem=report %]

[% IF report.category == 'Request new container' %]
Due to the current high demand, please allow up to 40 working days for this
Due to the current high demand, please allow up to
[% cobrand.wasteworks_config.request_timeframe %] for this
order to be processed. We thank you for your patience and understanding in
advance.
[% END %]
Expand Down
8 changes: 2 additions & 6 deletions templates/web/base/waste/confirmation.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ <h1 class="govuk-panel__title">
</p>
<p>
[% IF report.category == 'Request new container' %]
[% IF c.cobrand.moniker == 'kingston' %]
Containers typically arrive within 20 working days, but this may vary due to demand.
[% ELSIF c.cobrand.moniker == 'sutton' %]
Containers typically arrive within 40 working days, but this may vary due to demand.
[% ELSIF c.cobrand.moniker == 'bromley' %]
Containers typically arrive within two weeks, but this may vary due to demand.
[% IF c.cobrand.moniker == 'kingston' || c.cobrand.moniker == 'sutton' || c.cobrand.moniker == 'bromley' %]
Containers typically arrive within [% c.cobrand.wasteworks_config.request_timeframe %], but this may vary due to demand.
[% END %]
[% END %]
[% INCLUDE 'waste/_report_ids.html' %]
Expand Down
3 changes: 2 additions & 1 deletion templates/web/kingston/waste/_confirmation_after.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<h2>Order confirmation</h2>

<p>Your container request has been approved and should be with you within the next 20 working days. Please contact us after this time with your reference number if you haven’t received it.
<p>Your container request has been approved and should be with you within the next [% c.cobrand.wasteworks_config.request_timeframe %].
Please contact us after this time with your reference number if you haven’t received it.

<p>If you’ve requested any containers to be removed please leave these available at the front of your property.

Expand Down

0 comments on commit 6723ebe

Please sign in to comment.