diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-08-17 17:12:26 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-08-19 15:47:20 +0100 |
commit | 5c79337ad423cd7fc3cada9b7830d90726387987 (patch) | |
tree | 61615747eae7483722bea4c94309ef4d1cddac4c /perllib/Open311/GetUpdates.pm | |
parent | f5d6ec933c9fd4d57f9b56fec27f7c746a0706b9 (diff) |
Simplify/consolidate body restriction db code.
Make dashboard work properly in two-tier councils, showing reports sent
to both. Create an index on the array of the bodies_str column to speed
up performance, and use that throughout the code replacing all LIKE
scans. This also enables a simplifying tidy of the restriction code.
Diffstat (limited to 'perllib/Open311/GetUpdates.pm')
-rw-r--r-- | perllib/Open311/GetUpdates.pm | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/perllib/Open311/GetUpdates.pm b/perllib/Open311/GetUpdates.pm index 5007a1f82..bc55086f0 100644 --- a/perllib/Open311/GetUpdates.pm +++ b/perllib/Open311/GetUpdates.pm @@ -17,9 +17,8 @@ sub get_updates { api_key => $body->api_key ); - my $reports = FixMyStreet::App->model('DB::Problem')->search( + my $reports = FixMyStreet::App->model('DB::Problem')->to_body($body)->search( { - bodies_str => { like => "\%" . $body->id . "\%" }, state => { 'IN', [qw/confirmed fixed/] }, -and => [ external_id => { '!=', undef }, |