diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-09-24 13:06:44 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-09-25 10:57:12 +0100 |
commit | cdd94a3de1445d0aea4dfc8c18cbae9e315bdda9 (patch) | |
tree | 86e5f23db56e5d632d00b812af8988a158997472 /perllib/FixMyStreet/App/Controller/Dashboard.pm | |
parent | 785c6cebec327ebf1518c08f1447dbd12224b952 (diff) |
Speed up fetching lists of bodies.
Use a HashRefInflator wherever all_sorted is used, with consequential
changes to deal with it now not being an object (e.g. add some with_*
functions for manual fetching of extra data).
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Dashboard.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index 790e7ec29..aadd913ca 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -99,7 +99,9 @@ sub index : Path : Args(0) { $c->stash->{body_name} = join "", map { $children->{$_}->{name} } grep { $children->{$_} } $c->user->area_id; } } else { - my @bodies = $c->model('DB::Body')->active->translated->with_area_count->all_sorted; + my @bodies = $c->model('DB::Body')->search(undef, { + columns => [ "id", "name" ], + })->active->translated->with_area_count->all_sorted; $c->stash->{bodies} = \@bodies; } |