diff options
author | francis <francis> | 2008-09-11 10:37:37 +0000 |
---|---|---|
committer | francis <francis> | 2008-09-11 10:37:37 +0000 |
commit | e366aa57a78d3b2d951bf4630a8d437ab8e18cfd (patch) | |
tree | 8cb3c8d37e584abf122ab6d143f11f016dffe7a4 /app/controllers/admin_controller.rb | |
parent | 648d2b232a92e2f7dc518ff1e934ded6eea3eee9 (diff) |
Factor out an SQL fragment.
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r-- | app/controllers/admin_controller.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 7ff75064c..9091cb008 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: admin_controller.rb,v 1.20 2008-09-08 01:49:57 francis Exp $ +# $Id: admin_controller.rb,v 1.21 2008-09-11 10:37:37 francis Exp $ class AdminController < ApplicationController layout "admin" @@ -19,10 +19,9 @@ class AdminController < ApplicationController @comment_count = Comment.count # Tasks to do - last_event_time_clause = '(select created_at from info_request_events where info_request_events.info_request_id = info_requests.id order by created_at desc limit 1)' - @requires_admin_requests = InfoRequest.find(:all, :select => '*, ' + last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'requires_admin'"], :order => "last_event_time") + @requires_admin_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'requires_admin'"], :order => "last_event_time") @blank_contacts = PublicBody.find(:all, :conditions => ["request_email = ''"], :order => "updated_at") - @ten_days_old_unclassified = InfoRequest.find(:all, :select => '*, ' + last_event_time_clause + ' as last_event_time', :conditions => [ "awaiting_description = ? and " + last_event_time_clause + " < ? and prominence != 'backpage'", true, Time.now() - 10.days ], :order => "last_event_time") + @ten_days_old_unclassified = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => [ "awaiting_description = ? and " + InfoRequest.last_event_time_clause + " < ? and prominence != 'backpage'", true, Time.now() - 10.days ], :order => "last_event_time") @holding_pen_messages = InfoRequest.holding_pen_request.incoming_messages end |