aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/general_controller.rb6
-rw-r--r--app/models/info_request.rb19
-rw-r--r--config/routes.rb2
3 files changed, 0 insertions, 27 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 9d0f91dda..4fd0c3deb 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -211,12 +211,6 @@ class GeneralController < ApplicationController
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
end
- # Jump to a random request
- def random_request
- info_request = InfoRequest.random
- redirect_to request_url(info_request)
- end
-
def custom_css
long_cache
@locale = self.locale_from_params()
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index cf1af0e87..5d73fbca9 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1081,25 +1081,6 @@ public
InfoRequest.update_all "allow_new_responses_from = 'nobody' where updated_at < (now() - interval '1 year') and allow_new_responses_from in ('anybody', 'authority_only') and url_title <> 'holding_pen'"
end
- # Returns a random FOI request
- def InfoRequest.random
- max_id = InfoRequest.connection.select_value('select max(id) as a from info_requests').to_i
- info_request = nil
- count = 0
- while info_request.nil?
- if count > 100
- return nil
- end
- id = rand(max_id) + 1
- begin
- count += 1
- info_request = find(id, :conditions => ["prominence = 'normal'"])
- rescue ActiveRecord::RecordNotFound
- end
- end
- return info_request
- end
-
def json_for_api(deep)
ret = {
:id => self.id,
diff --git a/config/routes.rb b/config/routes.rb
index 1895543d7..bc03d91e1 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -24,8 +24,6 @@ Alaveteli::Application.routes.draw do
match '/search/*combined/all' => 'general#search', :as => :search_general, :view => 'all'
match '/search(/*combined)' => 'general#search', :as => :search_general
match '/advancedsearch' => 'general#search_redirect', :as => :advanced_search, :advanced => true
-
- match '/random' => 'general#random_request', :as => :random_request
#####
##### Request controller