aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/JSON.pm
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2013-02-06 15:08:23 +0000
committerDave Whiteland <dave@mysociety.org>2013-02-06 15:08:23 +0000
commit0f24a44cd6e8b056db482cb91c85768b6d1e7d1d (patch)
tree09a90f38574ee62754f3c8ac077152ed99a38296 /perllib/FixMyStreet/App/Controller/JSON.pm
parentc061769ba72f420e2f2c6064fa526648e57339f1 (diff)
parent5b2e18389734751165d2eeb21a3b3f2e8d2e8755 (diff)
Merge remote branch 'origin/master' into oxfordshire-header
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/JSON.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/JSON.pm20
1 files changed, 5 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm
index f3607341a..1a7c1915b 100644
--- a/perllib/FixMyStreet/App/Controller/JSON.pm
+++ b/perllib/FixMyStreet/App/Controller/JSON.pm
@@ -92,7 +92,7 @@ sub problems : Local {
my @problems = $c->cobrand->problems->search( $query, {
order_by => { -asc => 'confirmed' },
columns => [
- 'id', 'title', 'council', 'category',
+ 'id', 'title', 'bodies_str', 'category',
'detail', 'name', 'anonymous', 'confirmed',
'whensent', 'service',
'latitude', 'longitude', 'used_map',
@@ -100,23 +100,13 @@ sub problems : Local {
]
} );
- my @councils;
foreach my $problem (@problems) {
$problem->name( '' ) if $problem->anonymous == 1;
$problem->service( 'Web interface' ) if $problem->service eq '';
- if ($problem->council) {
- (my $council = $problem->council) =~ s/\|.*//g;
- my @council_ids = split /,/, $council;
- push(@councils, @council_ids);
- $problem->council( \@council_ids );
- }
- }
- @councils = uniq @councils;
- my $areas_info = mySociety::MaPit::call('areas', \@councils);
- foreach my $problem (@problems) {
- if ($problem->council) {
- my @council_names = map { $areas_info->{$_}->{name} } @{$problem->council} ;
- $problem->council( join(' and ', @council_names) );
+ my $bodies = $problem->bodies;
+ if (keys %$bodies) {
+ my @body_names = map { $_->name } values %$bodies;
+ $problem->bodies_str( join(' and ', @body_names) );
}
}