diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-07 16:46:05 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-07 16:46:05 +0100 |
commit | a82a51695eacf94b7523502b3a48e1de6836fec0 (patch) | |
tree | 214d4928cc0a71f8a56adcce913af9118cfb0b92 /perllib/FixMyStreet/DB/ResultSet/Comment.pm | |
parent | 00952f9a897777a4351f51c2728c52e43c6ea760 (diff) |
admin timeline
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Comment.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Comment.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Comment.pm b/perllib/FixMyStreet/DB/ResultSet/Comment.pm new file mode 100644 index 000000000..4719c7a24 --- /dev/null +++ b/perllib/FixMyStreet/DB/ResultSet/Comment.pm @@ -0,0 +1,27 @@ +package FixMyStreet::DB::ResultSet::Comment; +use base 'DBIx::Class::ResultSet'; + +use strict; +use warnings; + +sub timeline { + my ( $rs, $restriction ) = @_; + + my $prefetch = + FixMyStreet::App->model('DB')->schema->storage->sql_maker->quote_char ? + [ qw/user/ ] : + []; + + return $rs->search( + { + state => 'confirmed', + created => { '>=', \"ms_current_timestamp()-'7 days'::interval" }, + %{ $restriction }, + }, + { + prefetch => $prefetch, + } + ); +} + +1; |