diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fixmystreet.com/buckinghamshire-flytipping | 30 | ||||
-rwxr-xr-x | bin/fixmystreet.com/fixture | 2 | ||||
-rw-r--r-- | bin/fixmystreet.com/one-off-move-js-messages-to-db | 2 |
3 files changed, 22 insertions, 12 deletions
diff --git a/bin/fixmystreet.com/buckinghamshire-flytipping b/bin/fixmystreet.com/buckinghamshire-flytipping index 70a37ea34..a312f9fbe 100755 --- a/bin/fixmystreet.com/buckinghamshire-flytipping +++ b/bin/fixmystreet.com/buckinghamshire-flytipping @@ -14,8 +14,8 @@ BEGIN { require "$d/../../setenv.pl"; } -use constant BUCKS_AREA_ID => 2217; -use constant DISTRICT_IDS => (2255, 2256, 2257, 2258); +use constant BUCKS_NAME => 'Buckinghamshire Council'; +use constant EX_DISTRICTS => ['Aylesbury Vale District Council', 'Chiltern District Council', 'South Bucks District Council', 'Wycombe District Council']; use constant TIME_OPEN => '3 weeks'; use constant TIME_OPEN_ALERT => '6 weeks'; @@ -30,11 +30,11 @@ my ($opts, $usage) = describe_options( ); print($usage->text), exit if $opts->help; -my $body = FixMyStreet::DB->resultset("Body")->for_areas(BUCKS_AREA_ID)->first; +my $body = FixMyStreet::DB->resultset("Body")->search({ name => BUCKS_NAME })->first; die "Could not find Bucks body" unless $body; -my @districts = FixMyStreet::DB->resultset("Body")->for_areas(DISTRICT_IDS)->all; -my @district_ids = map { $_->id } grep { $_->name ne 'TfL' } @districts; +my @districts = FixMyStreet::DB->resultset("Body")->search({ name => EX_DISTRICTS })->all; +my @district_ids = map { $_->id } @districts; die "Did not find all districts" unless @district_ids == 4; find_problems(TIME_OPEN_ALERT, TIME_OPEN, 'Auto-closure', 1); @@ -57,12 +57,22 @@ sub find_problems { $time_param = { '<', \$to }; } - # Fetch all Flytipping problems sent only to districts, between $from and $to - my $q = FixMyStreet::DB->resultset("Problem")->search( - \[ "? @> regexp_split_to_array(bodies_str, ',')", [ {} => \@district_ids ] ] - )->search({ + # Fetch all Flytipping problems made off-road (i.e. those that previously + # would been sent only to districts) any any older ones which actually were + # sent to districts, between $from and $to + my $q = FixMyStreet::DB->resultset("Problem")->search([ + # Reports sent to district, made before the unitary switchover + -and => [ + \[ "? @> regexp_split_to_array(bodies_str, ',')", [ {} => \@district_ids ] ], + category => 'Flytipping' + ], + # Reports sent to Bucks Council after unitary switchover + { + bodies_str => $body->id, + category => 'Flytipping (off-road)' + } + ])->search({ state => [ FixMyStreet::DB::Result::Problem->open_states() ], - category => 'Flytipping', confirmed => $time_param, }); diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture index 9c471a941..f4a9fbef1 100755 --- a/bin/fixmystreet.com/fixture +++ b/bin/fixmystreet.com/fixture @@ -95,7 +95,7 @@ if ($opt->test_fixtures) { my $bodies; foreach ( { area_id => 2234, categories => ['Shelter Damaged', 'Very Urgent'], name => 'Northamptonshire County Council' }, - { area_id => 2217, categories => ['Flytipping', 'Roads', 'Parks'], name => 'Buckinghamshire County Council' }, + { area_id => 2217, categories => ['Flytipping', 'Roads', 'Parks'], name => 'Buckinghamshire Council' }, { area_id => 2257, categories => ['Flytipping', 'Graffiti'], name => 'Chiltern District Council' }, { area_id => 2397, categories => [ 'Graffiti' ], name => 'Northampton Borough Council' }, { area_id => 2483, categories => [ 'Potholes', 'Other' ], name => 'Hounslow Borough Council' }, diff --git a/bin/fixmystreet.com/one-off-move-js-messages-to-db b/bin/fixmystreet.com/one-off-move-js-messages-to-db index 1f03a56e2..bdbcd0a8c 100644 --- a/bin/fixmystreet.com/one-off-move-js-messages-to-db +++ b/bin/fixmystreet.com/one-off-move-js-messages-to-db @@ -33,7 +33,7 @@ my @messages = ( message => 'Please report problems with rights of way using <a href="https://publicrightsofway.oxfordshire.gov.uk/web/standardmap.aspx">this page</a>.' }, { - body => 'Buckinghamshire County Council', + body => 'Buckinghamshire Council', category => 'Rights of Way', message => 'If you wish to report an issue on a Public Right of Way, please use <a href="https://www.buckscc.gov.uk/services/environment/public-rights-of-way/report-a-rights-of-way-issue/">this service</a>.' }, |