aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortony <tony>2009-03-10 12:04:55 +0000
committertony <tony>2009-03-10 12:04:55 +0000
commit3c1d50f4f55196621bc2e50ebee4e017d138515f (patch)
tree4cc63663d0dbc51bee530cd63f720aea96f2fca5
parent7edb222ce842ee028c746e76429edae12117995c (diff)
Restrict 'ten days old unclassified' on front page of admin to 50
entries to speed up that page, and provide full list as separate page
-rw-r--r--app/controllers/admin_general_controller.rb4
-rw-r--r--app/controllers/admin_request_controller.rb14
-rw-r--r--app/views/admin_general/index.rhtml3
-rw-r--r--app/views/admin_request/list_old_unclassified.rhtml15
-rw-r--r--config/routes.rb3
5 files changed, 34 insertions, 5 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index b5958cd73..3d2bf74df 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_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_general_controller.rb,v 1.2 2009-02-27 22:32:13 francis Exp $
+# $Id: admin_general_controller.rb,v 1.3 2009-03-10 12:04:55 tony Exp $
class AdminGeneralController < AdminController
def index
@@ -19,7 +19,7 @@ class AdminGeneralController < AdminController
@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")
@error_message_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'error_message'"], :order => "last_event_time")
@blank_contacts = PublicBody.find(:all, :conditions => ["request_email = ''"], :order => "updated_at")
- @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")
+ @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", :limit => 50)
@holding_pen_messages = InfoRequest.holding_pen_request.incoming_messages
end
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 6bba0bc88..33b04e7fe 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_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_request_controller.rb,v 1.29 2009-01-29 12:10:10 francis Exp $
+# $Id: admin_request_controller.rb,v 1.30 2009-03-10 12:04:55 tony Exp $
class AdminRequestController < AdminController
def index
@@ -18,6 +18,18 @@ class AdminRequestController < AdminController
:conditions => @query.nil? ? nil : ["lower(title) like lower('%'||?||'%')", @query]
end
+ def list_old_unclassified
+ @info_requests = 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"
+ )
+ end
+
def show
@info_request = InfoRequest.find(params[:id])
end
diff --git a/app/views/admin_general/index.rhtml b/app/views/admin_general/index.rhtml
index d15f619f1..87de83752 100644
--- a/app/views/admin_general/index.rhtml
+++ b/app/views/admin_general/index.rhtml
@@ -33,7 +33,7 @@
<% end %>
<% if @ten_days_old_unclassified.size > 0 %>
- <h3>Classify responses that are still unclassified ten days after response (<%=@ten_days_old_unclassified.size%> total)</h3>
+ <h3>Classify responses that are still unclassified ten days after response</h3>
<ul>
<% for @request in @ten_days_old_unclassified %>
@@ -43,6 +43,7 @@
</li>
<% end %>
</ul>
+ <p>(<%= link_to "Full list", admin_url("unclassified") %>)
<% end %>
<% if @error_message_requests.size > 0 %>
diff --git a/app/views/admin_request/list_old_unclassified.rhtml b/app/views/admin_request/list_old_unclassified.rhtml
new file mode 100644
index 000000000..3db40528e
--- /dev/null
+++ b/app/views/admin_request/list_old_unclassified.rhtml
@@ -0,0 +1,15 @@
+<% @title = "Unclassfied responses" %>
+
+<h1><%=@title%></h1>
+
+<p>Classify responses that are still unclassified ten days after response:</p>
+<ul>
+<% for @request in @info_requests %>
+ <li>
+ <%= request_both_links(@request) %>
+ &ndash; <%=simple_date(@request.get_last_event.created_at)%>
+ </li>
+<% end %>
+</ul>
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 36fe71489..f60d5a611 100644
--- a/config/routes.rb
+++ b/config/routes.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: routes.rb,v 1.83 2009-03-10 10:33:52 tony Exp $
+# $Id: routes.rb,v 1.84 2009-03-10 12:04:55 tony Exp $
ActionController::Routing::Routes.draw do |map|
@@ -95,6 +95,7 @@ ActionController::Routing::Routes.draw do |map|
map.connect '/admin/debug', :controller => 'admin_general', :action => 'debug'
map.connect '/admin/stats', :controller => 'admin_general', :action => 'stats'
map.connect '/admin/missing_scheme', :controller => 'admin_public_body', :action => 'missing_scheme'
+ map.connect '/admin/unclassified', :controller => 'admin_request', :action => 'list_old_unclassified'
map.connect '/admin/body/:action/:id', :controller => 'admin_public_body'
map.connect '/admin/request/:action/:id', :controller => 'admin_request'
map.connect '/admin/user/:action/:id', :controller => 'admin_user'