aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/general_controller.rb4
-rw-r--r--app/models/info_request.rb11
-rw-r--r--app/models/info_request_event.rb3
3 files changed, 12 insertions, 6 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 4eb671af6..16f34f1b8 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -5,7 +5,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: general_controller.rb,v 1.13 2008-03-31 19:15:30 francis Exp $
+# $Id: general_controller.rb,v 1.14 2008-03-31 23:19:16 francis Exp $
class GeneralController < ApplicationController
@@ -61,6 +61,8 @@ class GeneralController < ApplicationController
order = nil
elsif @sortby == 'newest'
order = 'created_at desc'
+ elsif @sortby == 'described'
+ order = 'last_described_at desc' # use this for RSS
else
raise "Unknown sort order " + @sortby
end
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