aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-09-11 10:37:37 +0000
committerfrancis <francis>2008-09-11 10:37:37 +0000
commite366aa57a78d3b2d951bf4630a8d437ab8e18cfd (patch)
tree8cb3c8d37e584abf122ab6d143f11f016dffe7a4 /app/models/user.rb
parent648d2b232a92e2f7dc518ff1e934ded6eea3eee9 (diff)
Factor out an SQL fragment.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index f0416506e..579ab7265 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -22,7 +22,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.66 2008-08-31 14:08:55 francis Exp $
+# $Id: user.rb,v 1.67 2008-09-11 10:37:37 francis Exp $
require 'digest/sha1'
@@ -164,6 +164,16 @@ class User < ActiveRecord::Base
return u
end
+ # Returns list of requests which the user hasn't described.
+ def get_undescribed_requests
+ self.info_requests.find(
+ :all,
+ :conditions => [ 'awaiting_description = ? and ' + InfoRequest.last_event_time_clause + ' < ?',
+ true, Time.now() - 1.day
+ ]
+ )
+ end
+
# Does the user magically gain powers as if they owned every request?
# e.g. Can classify it
def owns_every_request?