From e57cbf483790bedfef6496be3c7ffa42882c3ffc Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 13 Jun 2017 18:39:05 +0100 Subject: [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. --- perllib/FixMyStreet/App/Controller/JSON.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller/JSON.pm') diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm index d3cd33546..762e3c115 100644 --- a/perllib/FixMyStreet/App/Controller/JSON.pm +++ b/perllib/FixMyStreet/App/Controller/JSON.pm @@ -105,10 +105,9 @@ sub problems : Local { foreach my $problem (@problems) { $problem->name( '' ) if $problem->anonymous == 1; $problem->service( 'Web interface' ) if $problem->service eq ''; - my $bodies = $problem->bodies; - if (keys %$bodies) { - my @body_names = map { $_->name } values %$bodies; - $problem->bodies_str( join(' and ', @body_names) ); + my $body_names = $problem->body_names; + if (@$body_names) { + $problem->bodies_str( join(' and ', @$body_names) ); } } -- cgit v1.2.3