diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-11-21 15:13:14 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-11-25 16:11:53 +0000 |
commit | 70c5bb9845dc2438eef2b76fead0e76d21744a3b (patch) | |
tree | 67d87ec27f34399be1f1bbd93a7a99f8cbb775d8 /app/controllers/general_controller.rb | |
parent | b54aef5dda20fc9ff15a0ef3dd72327e52c8604c (diff) |
Move getting popular bodies into a model method.
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r-- | app/controllers/general_controller.rb | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index beefef4e6..e138ec120 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -12,28 +12,7 @@ class GeneralController < ApplicationController # New, improved front page! def frontpage medium_cache - # get some example searches and public bodies to display - # either from config, or based on a (slow!) query if not set - body_short_names = AlaveteliConfiguration::frontpage_publicbody_examples.split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ") @locale = self.locale_from_params() - locale_condition = 'public_body_translations.locale = ?' - conditions = [locale_condition, @locale] - I18n.with_locale(@locale) do - if body_short_names.empty? - # This is too slow - @popular_bodies = PublicBody.visible.find(:all, - :order => "info_requests_count desc", - :limit => 32, - :conditions => conditions, - :joins => :translations - ) - else - conditions[0] += " and public_bodies.url_name in (" + body_short_names + ")" - @popular_bodies = PublicBody.find(:all, - :conditions => conditions, - :joins => :translations) - end - end # Get some successful requests begin query = 'variety:response (status:successful OR status:partially_successful)' |