aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/ResultSet/Comment.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-07 16:46:05 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-07 16:46:05 +0100
commita82a51695eacf94b7523502b3a48e1de6836fec0 (patch)
tree214d4928cc0a71f8a56adcce913af9118cfb0b92 /perllib/FixMyStreet/DB/ResultSet/Comment.pm
parent00952f9a897777a4351f51c2728c52e43c6ea760 (diff)
admin timeline
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Comment.pm')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Comment.pm27
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;