aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/info_request.rb11
-rw-r--r--app/models/info_request_event.rb3
2 files changed, 9 insertions, 5 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 791bbf753..1bc6004aa 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.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: info_request.rb,v 1.77 2008-03-31 19:15:38 francis Exp $
+# $Id: info_request.rb,v 1.78 2008-03-31 23:19:16 francis Exp $
require 'digest/sha1'
@@ -244,10 +244,13 @@ public
curr_state = event.described_state
end
- if not curr_state.nil? and event.event_type == 'response'
- event.calculated_state = curr_state
+ if !curr_state.nil? && event.event_type == 'response'
+ if event.calculated_state != curr_state
+ event.calculated_state = curr_state
+ event.last_described_at = Time.now()
+ event.save!
+ end
curr_state = nil
- event.save!
end
end
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 5b176c1e5..d1798511b 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -17,7 +17,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.29 2008-03-31 22:41:34 francis Exp $
+# $Id: info_request_event.rb,v 1.30 2008-03-31 23:19:16 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
@@ -56,6 +56,7 @@ class InfoRequestEvent < ActiveRecord::Base
{ :requested_by => :string },
{ :requested_from => :string },
{ :created_at => :date },
+ { :last_described_at => :date },
{ :variety => :string }
], :if => "$do_solr_index"
def status # for name in Solr queries