diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-06-13 18:39:05 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-06-20 15:02:11 +0100 |
commit | e57cbf483790bedfef6496be3c7ffa42882c3ffc (patch) | |
tree | d01788502457f801a846cdac78213df5ecdf1ea5 /perllib/FixMyStreet/Cobrand/Angus.pm | |
parent | a5f311e5147621f285cf31647ce675c502095882 (diff) |
[UK] Remove requirement for fixed body IDs.
Historically in UK cobrands, bodies have had IDs the same as the MapIt
area ID they cover. This can be confusing (if you are setting up a dev
environment, say) and should not be necessary. This commit removes the
requirement entirely, by switching any ID checks to either the name of
the body, or the actual area it covers.
One note: the body name in the test has to match so that we do not get
two bodies both covering 2237 created. This will not be necessary when
the tests are compartmentalized in the next commit.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Angus.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Angus.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Angus.pm b/perllib/FixMyStreet/Cobrand/Angus.pm index 0361c2d11..51a3da56a 100644 --- a/perllib/FixMyStreet/Cobrand/Angus.pm +++ b/perllib/FixMyStreet/Cobrand/Angus.pm @@ -4,7 +4,7 @@ use parent 'FixMyStreet::Cobrand::UKCouncils'; use strict; use warnings; -sub council_id { return 2550; } +sub council_area_id { return 2550; } sub council_area { return 'Angus'; } sub council_name { return 'Angus Council'; } sub council_url { return 'angus'; } @@ -70,13 +70,17 @@ sub temp_update_contacts { my $contact_rs = $self->{c}->model('DB::Contact'); + my $body = FixMyStreet::DB->resultset('Body')->search({ + 'body_areas.area_id' => $self->council_area_id, + }, { join => 'body_areas' })->first; + my $_update = sub { my ($category, $field, $category_details) = @_; # NB: we're accepting just 1 field, but supply as array [ $field ] my $contact = $contact_rs->find_or_create( { - body_id => $self->council_id, + body => $body, category => $category, %{ $category_details || {} }, }, |