Skip to content

Commit

Permalink
[Kingston] Update for new data IDs and location.
Browse files Browse the repository at this point in the history
There is one service task per service unit; container information is
now on the service unit, not the task; all the IDs have changed.
  • Loading branch information
dracos committed Jan 27, 2025
1 parent f2728bb commit 2eb4fe5
Show file tree
Hide file tree
Showing 7 changed files with 452 additions and 142 deletions.
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/App/Form/Waste/Request/Kingston.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use utf8;
use HTML::FormHandler::Moose;
extends 'FixMyStreet::App::Form::Waste::Request';

use constant CONTAINER_REFUSE_240 => 2;
use constant CONTAINER_REFUSE_240 => 3;

=head2 About you
Expand Down
90 changes: 39 additions & 51 deletions perllib/FixMyStreet/Cobrand/Kingston.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,39 @@ sub council_url { return 'kingston'; }
sub admin_user_domain { 'kingston.gov.uk' }

my %TASK_IDS = (
domestic_refuse => 2238,
domestic_food => 2239,
domestic_paper => 2240,
domestic_mixed => 2241,
domestic_refuse_bag => 2242,
communal_refuse => 2243,
domestic_mixed_bag => 2246,
garden => 2247,
communal_food => 2248,
communal_paper => 2249,
communal_mixed => 2250,
domestic_paper_bag => 2632,
schedule2_mixed => 3571,
schedule2_refuse => 3576,
deliver_refuse_bags => 2256,
deliver_recycling_bags => 2257,
domestic_refuse => 4394,
domestic_food => 4389,
domestic_paper => 4388,
domestic_mixed => 4390,
domestic_refuse_bag => 4395,
communal_refuse => 4407,
domestic_mixed_bag => 4391,
garden => 4410,
communal_food => 4403,
communal_paper => 4396,
communal_mixed => 4397,
domestic_paper_bag => 4402,
schedule2_mixed => 4398,
schedule2_refuse => 4409,
deliver_refuse_bags => 4427,
deliver_recycling_bags => 4432,
);
lock_hash(%TASK_IDS);

my %CONTAINERS = (
refuse_140 => 1,
refuse_180 => 35,
refuse_240 => 2,
refuse_360 => 3,
recycling_box => 16,
recycling_240 => 12,
paper_240 => 19,
paper_140 => 36,
food_indoor => 23,
food_outdoor => 24,
garden_240 => 26,
garden_140 => 27,
garden_sack => 28,
refuse_180 => 2,
refuse_240 => 3,
refuse_360 => 4,
recycling_box => 12,
recycling_240 => 15,
paper_240 => 27,
paper_140 => 26,
food_indoor => 43,
food_outdoor => 46,
garden_240 => 39,
garden_140 => 37,
garden_sack => 36,
);
lock_hash(%CONTAINERS);

Expand Down Expand Up @@ -141,33 +141,21 @@ sub waste_containers {
};
return {
%$black_bins,
4 => 'Refuse Blue Sack',
5 => 'Refuse Black Sack',
6 => 'Refuse Red Stripe Bag',
18 => 'Mixed Recycling Blue Striped Bag',
29 => 'Recycling Single Use Bag',
21 => 'Paper & Card Reusable Bag',
22 => 'Paper Sacks',
30 => 'Paper & Card Recycling Clear Bag',
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)',
10 => 'Refuse Red Stripe Bag',
22 => 'Mixed Recycling Blue Striped Bag',
34 => 'Paper & Card Recycling Clear Bag',
8 => 'Communal Refuse bin (1100L)',
20 => 'Communal Recycling bin (1100L)',
51 => 'Communal Food bin (240L)',
$CONTAINERS{recycling_240} => 'Recycling bin (240L)',
13 => 'Recycling bin (360L)',
20 => 'Paper recycling bin (360L)',
31 => 'Paper 55L Box',
16 => 'Recycling bin (360L)',
28 => 'Paper recycling bin (360L)',
32 => 'Communal Paper bin (1100L)',
$CONTAINERS{recycling_240} => 'Green recycling bin (240L)',
13 => 'Green recycling bin (360L)',
16 => 'Green recycling bin (360L)',
$CONTAINERS{recycling_box} => 'Green recycling box (55L)',
$CONTAINERS{paper_240} => 'Blue lid paper and cardboard bin (240L)',
20 => 'Blue lid paper and cardboard bin (360L)',
28 => 'Blue lid paper and cardboard bin (360L)',
$CONTAINERS{food_indoor} => 'Food waste bin (kitchen)',
$CONTAINERS{food_outdoor} => 'Food waste bin (outdoor)',
$CONTAINERS{paper_140} => 'Blue lid paper and cardboard bin (180L)',
Expand Down
22 changes: 10 additions & 12 deletions t/app/controller/waste_kands_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ FixMyStreet::override_config {
echo => {
kingston => {
bulky_address_types => [ 1, 7 ],
bulky_service_id => 413,
bulky_event_type_id => 1636,
bulky_service_id => 986,
bulky_event_type_id => 3130,
url => 'http://example.org',
nlpg => 'https://example.com/%s',
},
Expand All @@ -68,8 +68,6 @@ FixMyStreet::override_config {
hmac_id => '1234',
scpID => '1234',
company_name => 'rbk',
form_name => 'rbk_user_form',
staff_form_name => 'rbk_staff_form',
customer_ref => 'customer-ref',
bulky_customer_ref => 'customer-ref-bulky',
} },
Expand All @@ -95,8 +93,8 @@ FixMyStreet::override_config {
);
$echo->mock('ReserveAvailableSlotsForEvent', sub {
my ($self, $service, $event_type, $property, $guid, $start, $end) = @_;
is $service, 413;
is $event_type, 1636;
is $service, 986;
is $event_type, 3130;
is $property, 12345;
return [
{
Expand Down Expand Up @@ -651,7 +649,7 @@ FixMyStreet::override_config {
$mech->content_lacks('Bulky waste collection');
$echo->mock( 'GetEventsForObject', sub { [ {
Guid => 'a-guid',
EventTypeId => 1636,
EventTypeId => 3130,
ResolvedDate => { DateTime => '2023-07-02T00:00:00Z' },
ResolutionCodeId => 232,
EventStateId => 12400,
Expand All @@ -662,7 +660,7 @@ FixMyStreet::override_config {
$mech->content_lacks('Bulky waste collection');
$echo->mock( 'GetEventsForObject', sub { [ {
Guid => 'a-guid',
EventTypeId => 1636,
EventTypeId => 3130,
ResolvedDate => { DateTime => '2023-07-05T00:00:00Z' },
ResolutionCodeId => 232,
EventStateId => 12400,
Expand All @@ -686,7 +684,7 @@ FixMyStreet::override_config {

$echo->mock( 'GetEventsForObject', sub { [ {
Guid => 'a-guid',
EventTypeId => 1636,
EventTypeId => 3130,
ResolvedDate => { DateTime => '2023-07-05T00:00:00Z' },
ResolutionCodeId => 379,
EventStateId => 12401,
Expand All @@ -698,13 +696,13 @@ FixMyStreet::override_config {
$mech->content_lacks('Bulky waste collection');
$echo->mock( 'GetEventsForObject', sub { [ {
Guid => 'a-guid',
EventTypeId => 1636,
EventTypeId => 3130,
ResolvedDate => { DateTime => '2023-07-05T00:00:00Z' },
ResolutionCodeId => 100,
EventStateId => 12401,
}, {
EventTypeId => 1571,
ServiceId => 413,
EventTypeId => 3145,
ServiceId => 986,
Guid => 'guid',
EventDate => { DateTime => '2023-07-05T00:00:00Z' },
} ] } );
Expand Down
190 changes: 190 additions & 0 deletions t/app/controller/waste_kingston_4443082.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
[
{
"Data": {
"ExtensibleDatum": {
"Value": "Paper Recycling 240L ",
"DatatypeName": "Recycling Containers",
"ChildData": {
"ExtensibleDatum": [
{ "DatatypeName": "Container Type", "Value": "27" },
{ "DatatypeName": "Container Quantity", "Value": "1" }
]
}
}
},
"ServiceTasks": {
"ServiceTask": [
{
"TaskTypeId": "4388",
"ServiceTaskSchedules": {
"ServiceTaskSchedule": {
"ScheduleDescription": "Friday every other week",
"NextInstance": {
"CurrentScheduledDate": { "DateTime": "2022-09-15T23:00:00Z" },
"OriginalScheduledDate": { "DateTime": "2022-09-15T23:00:00Z" }
},
"LastInstance": {
"CurrentScheduledDate": { "DateTime": "2022-09-02T05:00:00Z" },
"OriginalScheduledDate": { "DateTime": "2022-09-01T23:00:00Z" },
"Ref": { "Value": { "anyType": [ "22239416", "8280" ] } },
"CompletedDate": { "DateTime": "2022-09-02T06:17:01Z" }
},
"StartDate": { "DateTime": "2018-09-02T23:00:00Z" },
"EndDate": { "DateTime": "2050-01-01T00:00:00Z" }
}
},
"TaskIndicatorId": "33",
"Id": "2001",
"TaskTypeName": "Collect Domestic Paper",
"ScheduleDescription": "Every Friday fortnightly"
}
]
},
"ServiceName": "Domestic Paper Collection",
"ServiceId": "974",
"Id": "1001"
},
{
"Data": {
"ExtensibleDatum": [ {
"ChildData": {
"ExtensibleDatum": [
{ "Value": "46", "DatatypeName": "Container Type" },
{ "Value": "1", "DatatypeName": "Container Quantity" }
]
},
"DatatypeName": "Food Containers",
"DatatypeId": "3955",
"Value": "Food Caddy 23L"
} ]
},
"ServiceTasks": {
"ServiceTask": [
{
"TaskTypeId": "4389",
"ServiceTaskSchedules": {
"ServiceTaskSchedule": [
{
"LastInstance": {
"Ref": { "Value": { "anyType": [ "22244305", "8287" ] } },
"OriginalScheduledDate": { "DateTime": "2022-09-08T23:00:00Z" },
"CurrentScheduledDate": { "DateTime": "2022-09-09T05:00:00Z" },
"CompletedDate": { "DateTime": "2022-09-09T05:42:38.93Z" }
},
"StartDate": { "DateTime": "2018-09-02T23:00:00Z" },
"NextInstance": null,
"EndDate": { "DateTime": "2050-01-01T00:00:00Z" },
"ScheduleDescription": null
},
{
"EndDate": { "DateTime": "2050-01-01T00:00:00Z" },
"StartDate": { "DateTime": "2018-09-02T23:00:00Z" },
"LastInstance": null,
"NextInstance": {
"CurrentScheduledDate": { "DateTime": "2022-09-15T23:00:00Z" },
"OriginalScheduledDate": { "DateTime": "2022-09-15T23:00:00Z" }
},
"ScheduleDescription": "Friday every other week"
}
]
},
"TaskIndicatorId": "33",
"TaskTypeName": "Collect Domestic Food",
"Id": "2002",
"ScheduleDescription": "Every Friday"
}
]
},
"ServiceName": "Domestic Food Collection",
"ServiceId": "980",
"Id": "1002"
},
{
"Data": {
"ExtensibleDatum": {
"DatatypeName": "Recycling Containers",
"DatatypeId": "3964",
"Value": "Recycling 55L Box",
"ChildData": {
"ExtensibleDatum": [
{ "Value": "12", "DatatypeName": "Container Type" },
{ "Value": "3", "DatatypeName": "Container Quantity" }
]
}
}
},
"ServiceTasks": {
"ServiceTask": [
{
"TaskIndicatorId": "33",
"ServiceTaskSchedules": {
"ServiceTaskSchedule": {
"ScheduleDescription": "Friday every other week",
"NextInstance": {
"CurrentScheduledDate": { "DateTime": "2022-09-22T23:00:00Z" },
"OriginalScheduledDate": { "DateTime": "2022-09-22T23:00:00Z" }
},
"StartDate": { "DateTime": "2017-01-01T00:00:00Z" },
"LastInstance": {
"CompletedDate": { "DateTime": "2022-09-09T05:52:03.367Z" },
"Ref": { "Value": { "anyType": [ "17510905", "8287" ] } },
"CurrentScheduledDate": { "DateTime": "2022-09-09T05:00:00Z" },
"OriginalScheduledDate": { "DateTime": "2022-09-08T23:00:00Z" }
},
"EndDate": { "DateTime": "2050-01-01T00:00:00Z" }
}
},
"TaskTypeId": "4390",
"ScheduleDescription": "Every Friday fortnightly",
"TaskTypeName": "Collect Domestic Recycling",
"Id": "2003"
}
]
},
"ServiceName": "Domestic Recycling Collection",
"ServiceId": "970",
"Id": "1003"
},
{
"ServiceId": "966",
"ServiceName": "Domestic Refuse Collection",
"Id": "1004",
"Data": {
"ExtensibleDatum": {
"ChildData": {
"ExtensibleDatum": [
{ "Value": "3", "DatatypeName": "Container Type" },
{ "Value": "1", "DatatypeName": "Container Quantity" }
]
},
"DatatypeName": "Refuse Containers"
}
},
"ServiceTasks": {
"ServiceTask": {
"ScheduleDescription": "Every Friday fortnightly",
"Id": "2004",
"TaskTypeName": "Collect Domestic Refuse Bin",
"TaskIndicatorId": "33",
"ServiceTaskSchedules": {
"ServiceTaskSchedule": {
"ScheduleDescription": "Friday every other week",
"EndDate": { "DateTime": "2050-01-01T00:00:00Z" },
"StartDate": { "DateTime": "2017-01-01T00:00:00Z" },
"LastInstance": {
"Ref": { "Value": { "anyType": [ "17430692", "8287" ] } },
"CurrentScheduledDate": { "DateTime": "2022-09-09T05:00:00Z" },
"OriginalScheduledDate": { "DateTime": "2022-09-08T23:00:00Z" },
"CompletedDate": { "DateTime": "2022-09-09T08:19:22.76Z" }
},
"NextInstance": {
"OriginalScheduledDate": { "DateTime": "2022-09-22T23:00:00Z" },
"CurrentScheduledDate": { "DateTime": "2022-09-22T23:00:00Z" }
}
}
},
"TaskTypeId": "4394"
}
}
}
]
Loading

0 comments on commit 2eb4fe5

Please sign in to comment.