aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/Result/Body.pm2
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Alert.pm7
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Comment.pm7
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm9
4 files changed, 5 insertions, 20 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm
index 7251bc863..afbeda88a 100644
--- a/perllib/FixMyStreet/DB/Result/Body.pm
+++ b/perllib/FixMyStreet/DB/Result/Body.pm
@@ -246,7 +246,7 @@ sub calculate_average {
'problem.state' => [ FixMyStreet::DB::Result::Problem->visible_states() ],
}, {
select => [
- { extract => "epoch from me.confirmed-problem.confirmed", -as => 'time' },
+ { extract => \"epoch from me.confirmed-problem.confirmed", -as => 'time' },
],
as => [ qw/time/ ],
rows => 100,
diff --git a/perllib/FixMyStreet/DB/ResultSet/Alert.pm b/perllib/FixMyStreet/DB/ResultSet/Alert.pm
index c61053fff..ddf80bc52 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Alert.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Alert.pm
@@ -7,11 +7,6 @@ use warnings;
sub timeline_created {
my ( $rs, $restriction ) = @_;
- my $prefetch =
- $rs->result_source->storage->sql_maker->quote_char ?
- [ qw/alert_type user/ ] :
- [ qw/alert_type/ ];
-
return $rs->search(
{
whensubscribed => { '>=', \"current_timestamp-'7 days'::interval" },
@@ -19,7 +14,7 @@ sub timeline_created {
%{ $restriction },
},
{
- prefetch => $prefetch,
+ prefetch => [ qw/alert_type user/ ],
}
);
}
diff --git a/perllib/FixMyStreet/DB/ResultSet/Comment.pm b/perllib/FixMyStreet/DB/ResultSet/Comment.pm
index b9a3df62d..034b86a40 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Comment.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Comment.pm
@@ -13,18 +13,13 @@ sub to_body {
sub timeline {
my ( $rs ) = @_;
- my $prefetch =
- $rs->result_source->storage->sql_maker->quote_char ?
- [ qw/user/ ] :
- [];
-
return $rs->search(
{
'me.state' => 'confirmed',
'me.created' => { '>=', \"current_timestamp-'7 days'::interval" },
},
{
- prefetch => $prefetch,
+ prefetch => 'user',
}
);
}
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 4f7c1dc5f..72a9852fc 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -141,7 +141,7 @@ sub _recent {
$query->{photo} = { '!=', undef } if $photos;
my $attrs = {
- order_by => { -desc => 'coalesce(confirmed, created)' },
+ order_by => { -desc => \'coalesce(confirmed, created)' },
rows => $num,
};
@@ -207,11 +207,6 @@ sub around_map {
sub timeline {
my ( $rs ) = @_;
- my $prefetch =
- $rs->result_source->storage->sql_maker->quote_char ?
- [ qw/user/ ] :
- [];
-
return $rs->search(
{
-or => {
@@ -221,7 +216,7 @@ sub timeline {
}
},
{
- prefetch => $prefetch,
+ prefetch => 'user',
}
);
}