aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-12-14 19:07:08 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-12-19 14:43:26 +0000
commitddf9dbdbf6486c781ca4a5822614b0b7cee2c062 (patch)
tree09c12affc3390138b03292d3f90810287b4941d0 /perllib/FixMyStreet/App/Controller/Report/New.pm
parentda29e8a75eaa92e98807ad89d29d3d1f3c01bc14 (diff)
Allow bodies to span multiple area IDs, and areas can be covered by more than one body.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 09e46ccef..c3525b2c9 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -580,7 +580,10 @@ sub setup_categories_and_bodies : Private {
my $all_areas = $c->stash->{all_areas};
my $first_area = ( values %$all_areas )[0];
- my @bodies = $c->model('DB::Body')->search( { area_id => [ keys %$all_areas ] } )->all;
+ my @bodies = $c->model('DB::Body')->search(
+ { 'body_areas.area_id' => [ keys %$all_areas ] },
+ { join => 'body_areas' }
+ )->all;
my %bodies = map { $_->id => $_ } @bodies;
my $first_body = ( values %bodies )[0];