aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-02-22 01:58:36 +0000
committerfrancis <francis>2008-02-22 01:58:36 +0000
commit712200c7531958860e9a85ff812d1aea29d2fe77 (patch)
tree8c8c58657679eca7d0fb9d392cfea3638c1ece92 /app/models/info_request.rb
parent6c8f0e9b5780b31ada206ec29a27d9ad7af0f226 (diff)
When a response is overdue, email the request creator to tell them so they can send a followup.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index bad751efe..48ccedcc1 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -20,7 +20,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.44 2008-02-21 20:45:51 francis Exp $
+# $Id: info_request.rb,v 1.45 2008-02-22 01:58:36 francis Exp $
require 'digest/sha1'
@@ -36,6 +36,7 @@ class InfoRequest < ActiveRecord::Base
has_many :outgoing_messages
has_many :incoming_messages
has_many :info_request_events
+ has_many :user_info_request_sent_alerts
belongs_to :dsecribed_last_incoming_message_id
@@ -280,6 +281,17 @@ public
return nil
end
+ # The last outgoing message
+ def get_last_outgoing_event
+ events = self.info_request_events.find(:all, :order => "created_at")
+ events.reverse.each do |e|
+ if e.event_type == 'sent' || e.event_type == 'resent' || e.event_type == 'followup_sent'
+ return e
+ end
+ end
+ return nil
+ end
+
# Text from the the initial request, for use in summary display
def initial_request_text
if outgoing_messages.empty? # mainly for use with incomplete fixtures