diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Alert.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Comment.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 9 |
3 files changed, 4 insertions, 19 deletions
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', } ); } |