aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorlouise <louise>2009-04-03 15:28:58 +0000
committerlouise <louise>2009-04-03 15:28:58 +0000
commit23533993102d6c0f702fbc1622d2051d698a9fb1 (patch)
tree7827a1862e2f54d5320a22b6750b79a21eeef731 /app/models/info_request.rb
parent9e589e9a7cf2bb2f7b9a36440cd3e723ea09e6f4 (diff)
Add method to info request for getting last event that needs a description - will replace calculation in RequestController
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index a31d20a59..2208de90e 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -23,7 +23,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request.rb,v 1.178 2009-03-17 09:53:58 tony Exp $
+# $Id: info_request.rb,v 1.179 2009-04-03 15:28:58 louise Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
@@ -537,6 +537,11 @@ public
return nil
end
+ def last_event_id_needing_description
+ last_event = events_needing_description[-1]
+ last_event.nil? ? 0 : last_event.id
+ end
+
# Returns all the events which the user hasn't described yet - an empty array if all described.
def events_needing_description
events = self.info_request_events