aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-03-19 18:08:47 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-03-19 18:14:54 +0000
commitd7a335a1002bf3e17bd19e034b9ee263ea623685 (patch)
treef7f3652357dff4e08e37403f317441620f0d50c7 /perllib/FixMyStreet/DB/Result/Problem.pm
parent130c0bf25f3ef8a9dda89c2aa3febb497f23a2c2 (diff)
[Zurich] Prefetch report users, cache body lookups
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 9feb98c76..fac0fc7ef 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -653,7 +653,8 @@ sub body {
my $body;
if ($problem->external_body) {
if ($problem->cobrand eq 'zurich') {
- $body = $c->model('DB::Body')->find({ id => $problem->external_body });
+ my $cache = $problem->result_source->schema->cache;
+ return $cache->{bodies}{$problem->external_body} //= $c->model('DB::Body')->find({ id => $problem->external_body });
} else {
$body = $problem->external_body;
}