aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm5
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm3
2 files changed, 6 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index c8af63987..453300cd5 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -1172,11 +1172,12 @@ sub admin_stats {
sub export_as_csv {
my ($self, $c, $params) = @_;
+ $c->model('DB')->schema->storage->sql_maker->quote_char('"');
my $csv = $c->stash->{csv} = {
problems => $c->model('DB::Problem')->search_rs(
$params,
{
- join => 'admin_log_entries',
+ join => ['admin_log_entries', 'user'],
distinct => 1,
columns => [
'id', 'created',
@@ -1190,6 +1191,7 @@ sub export_as_csv {
'service',
'extra',
{ sum_time_spent => { sum => 'admin_log_entries.time_spent' } },
+ 'name', 'user.id', 'user.email', 'user.phone', 'user.name',
]
}
),
@@ -1258,6 +1260,7 @@ sub export_as_csv {
filename => 'stats',
};
$c->forward('/dashboard/generate_csv');
+ $c->model('DB')->schema->storage->sql_maker->quote_char('');
}
sub problem_confirm_email_extras {
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;
}