aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/info_request.rb13
-rw-r--r--app/models/info_request_event.rb10
2 files changed, 10 insertions, 13 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 5ff0b3a1c..8743a8572 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.32 2008-01-30 09:53:47 francis Exp $
+# $Id: info_request.rb,v 1.33 2008-02-01 15:27:49 francis Exp $
require 'digest/sha1'
@@ -102,6 +102,7 @@ public
incoming_message.save!
self.awaiting_description = true
+ self.log_event("response", { :incoming_message_id => incoming_message.id })
self.save!
end
@@ -155,7 +156,7 @@ public
# Possibly just show 20 working days since the *last* message? Hmmm.
earliest_sent = self.outgoing_messages.map { |om| om.last_sent_at }.min
if earliest_sent.nil?
- raise "internal error, minimum last_sent_at for outgoing_messages is nil for request " + self.id.to_s
+ raise "internal error, minimum last_sent_at for outgoing_messages is nil for request " + self.id.to_s + " outgoing messages count " + self.outgoing_messages.size.to_s
end
days_passed = 0
@@ -227,12 +228,12 @@ public
# Returns all the messages which the user hasn't described yet
def incoming_messages_needing_description
if self.described_last_incoming_message_id.nil?
- correspondences = self.incoming_messages.find(:all)
+ incoming_messages = self.incoming_messages.find(:all)
else
- correspondences = self.incoming_messages.find(:all, :conditions => "id > " + self.described_last_incoming_message_id.to_s)
+ incoming_messages = self.incoming_messages.find(:all, :conditions => "id > " + self.described_last_incoming_message_id.to_s)
end
- correspondences.sort! { |a,b| a.sent_at <=> b.sent_at }
- return correspondences
+ incoming_messages.sort! { |a,b| a.sent_at <=> b.sent_at }
+ return incoming_messages
end
protected
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 0b5ac64f5..f291daca5 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -15,7 +15,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request_event.rb,v 1.8 2008-01-29 01:26:21 francis Exp $
+# $Id: info_request_event.rb,v 1.9 2008-02-01 15:27:49 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
@@ -28,7 +28,8 @@ class InfoRequestEvent < ActiveRecord::Base
'followup_sent',
'followup_resent',
'edit_outgoing', # outgoing message edited in admin interface
- 'manual' # you did something in the db by hand
+ 'manual', # you did something in the db by hand
+ 'response'
]
# We store YAML version of parameters in the database
@@ -39,11 +40,6 @@ class InfoRequestEvent < ActiveRecord::Base
YAML.load(self.params_yaml)
end
- # Used for sorting with the incoming/outgoing messages
- def sent_at
- created_at
- end
-
end