-
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include a script to send waste reports to a second endpoint.
- Loading branch information
Showing
22 changed files
with
1,133 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env perl | ||
# | ||
# This script sends waste reports additionally to Merton's | ||
# Open311 endpoint. They have already been sent to Echo. | ||
|
||
use v5.14; | ||
use warnings; | ||
|
||
BEGIN { # set all the paths to the perl code | ||
use File::Basename qw(dirname); | ||
use File::Spec; | ||
my $d = dirname(File::Spec->rel2abs($0)); | ||
require "$d/../../setenv.pl"; | ||
} | ||
|
||
use FixMyStreet::Script::Merton::SendWaste; | ||
|
||
my $send = FixMyStreet::Script::Merton::SendWaste->new; | ||
$send->send_reports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package FixMyStreet::App::Form::Waste::Request::Merton; | ||
|
||
use utf8; | ||
use HTML::FormHandler::Moose; | ||
extends 'FixMyStreet::App::Form::Waste::Request'; | ||
|
||
has_page about_you => ( | ||
fields => ['name', 'email', 'phone', 'continue'], | ||
intro => 'about_you.html', | ||
title => 'About you', | ||
next => 'summary', | ||
); | ||
|
||
has_page replacement => ( | ||
fields => ['request_reason', 'continue'], | ||
title => 'Reason for request', | ||
next => 'about_you', | ||
); | ||
|
||
has_field request_reason => ( | ||
required => 1, | ||
type => 'Select', | ||
widget => 'RadioGroup', | ||
label => 'Why do you need a replacement container?', | ||
); | ||
|
||
sub options_request_reason { | ||
my $form = shift; | ||
my @options = ( | ||
{ value => 'new_build', label => 'I am a new resident without a container' }, | ||
{ value => 'damaged', label => 'Damaged' }, | ||
{ value => 'missing', label => 'Missing' }, | ||
{ value => 'more', label => 'I need an additional container/bin' }, | ||
); | ||
return @options; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package FixMyStreet::Cobrand::Merton::Waste; | ||
|
||
use Moo::Role; | ||
with 'FixMyStreet::Roles::Cobrand::SLWP'; | ||
|
||
use FixMyStreet::App::Form::Waste::Request::Merton; | ||
|
||
has lpi_value => ( is => 'ro', default => 'MERTON' ); | ||
|
||
sub waste_auto_confirm_report { 1 } | ||
|
||
sub service_name_override { | ||
my ($self, $service) = @_; | ||
|
||
my %service_name_override = ( | ||
2238 => 'Non-recyclable Refuse', | ||
2239 => 'Food waste', | ||
2240 => 'Paper and card', | ||
2241 => 'Mixed recycling', | ||
2242 => 'Non-recyclable Refuse', | ||
2243 => 'Non-recyclable Refuse', | ||
2246 => 'Mixed recycling', | ||
2247 => 'Garden Waste', | ||
2248 => "Food waste", | ||
2249 => "Paper and card", | ||
2250 => "Mixed recycling", | ||
2632 => 'Paper and card', | ||
3571 => 'Mixed recycling', | ||
3576 => 'Non-recyclable Refuse', | ||
2256 => '', # Deliver refuse bags | ||
2257 => '', # Deliver recycling bags | ||
); | ||
|
||
return $service_name_override{$service->{ServiceId}} // ''; | ||
} | ||
|
||
sub waste_password_hidden { 1 } | ||
|
||
sub waste_containers { | ||
return { | ||
1 => 'Black rubbish bin (140L)', | ||
2 => 'Black rubbish bin (240L)', | ||
3 => 'Black rubbish bin (360L)', | ||
35 => 'Black rubbish bin (180L)', | ||
|
||
4 => 'Refuse Blue Sack', | ||
5 => 'Refuse Black Sack', | ||
6 => 'Refuse Red Stripe Bag', | ||
|
||
12 => 'Green recycling bin (240L)', | ||
13 => 'Green recycling bin (360L)', | ||
16 => 'Green recycling box (55L)', | ||
|
||
18 => 'Recycling Blue Stripe Bag', | ||
29 => 'Recycling Single Use Bag', | ||
|
||
19 => 'Blue lid paper and cardboard bin (240L)', | ||
20 => 'Blue lid paper and cardboard bin (360L)', | ||
36 => 'Blue lid paper and cardboard bin (180L)', | ||
|
||
21 => 'Paper & Card Reusable Bag', | ||
22 => 'Paper Sacks', | ||
30 => 'Paper Single Use Bag', | ||
31 => 'Paper 55L Box', | ||
|
||
23 => 'Food waste bin (kitchen)', | ||
24 => 'Food waste bin (outdoor)', | ||
|
||
26 => 'Garden waste bin (240L)', | ||
27 => 'Garden waste bin (140L)', | ||
28 => 'Garden waste sacks', | ||
|
||
7 => 'Communal Refuse bin (240L)', | ||
8 => 'Communal Refuse bin (360L)', | ||
9 => 'Communal Refuse bin (660L)', | ||
10 => 'Communal Refuse bin (1100L)', | ||
11 => 'Communal Refuse Chamberlain', | ||
33 => 'Communal Refuse bin (140L)', | ||
34 => 'Communal Refuse bin (1280L)', | ||
14 => 'Communal Recycling bin (660L)', | ||
15 => 'Communal Recycling bin (1100L)', | ||
25 => 'Communal Food bin (240L)', | ||
}; | ||
} | ||
|
||
sub image_for_unit { | ||
my ($self, $unit) = @_; | ||
my $base = '/i/waste-containers'; | ||
my $service_id = $unit->{service_id}; | ||
my $images = { | ||
2238 => "$base/bin-black", # refuse | ||
2239 => "$base/caddy-brown-large", # food | ||
2240 => "$base/bin-grey-blue-lid-recycling", # paper and card | ||
2241 => "$base/box-green-mix", # dry mixed | ||
2242 => "$base/sack-clear-red", # domestic refuse bag | ||
2243 => "$base/large-communal-grey-black-lid", # Communal refuse | ||
2246 => "$base/sack-clear-blue", # domestic recycling bag | ||
2247 => "$base/bin-brown", # garden | ||
#2248 => "$base/bin-brown", # Communal food | ||
#2249 => "$base/bin-grey-blue-lid-recycling", # Communal paper | ||
2250 => "$base/large-communal-green", # Communal recycling | ||
2632 => "$base/sack-clear", # domestic paper bag | ||
}; | ||
return $images->{$service_id}; | ||
} | ||
|
||
sub _closed_event { | ||
my ($self, $event) = @_; | ||
return 1 if $event->{ResolvedDate}; | ||
return 1 if $event->{ResolutionCodeId} && $event->{ResolutionCodeId} != 584; # Out of Stock | ||
return 0; | ||
} | ||
|
||
# TODO | ||
sub garden_container_data_extract { } | ||
sub waste_bulky_missed_blocked_codes {} | ||
|
||
sub waste_quantity_max { | ||
return ( | ||
2247 => 3, # Garden waste maximum | ||
); | ||
} | ||
|
||
sub waste_request_form_first_next { | ||
my $self = shift; | ||
return sub { | ||
my $data = shift; | ||
return 'about_you' if $data->{"container-18"} || $data->{"container-30"}; | ||
return 'replacement'; | ||
}; | ||
} | ||
|
||
sub garden_due_days { 30 } | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.