diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:10 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:10 +0100 |
commit | 77fdd7cd39bd6166932eb5286b251de79de0a57d (patch) | |
tree | f63e86efd270a5872b0a81e3495e3e63bbaa8c8f /app/controllers/request_game_controller.rb | |
parent | 0bf0be30cfbb866727a98ae22444aa0a724288b1 (diff) | |
parent | a622b31a33658696525ad675cdeb1e433f2a7c8b (diff) |
Merge branch 'develop' of git.mysociety.org:/data/git/public/alaveteli into develop
Diffstat (limited to 'app/controllers/request_game_controller.rb')
-rw-r--r-- | app/controllers/request_game_controller.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb index 904c44759..f22652dd1 100644 --- a/app/controllers/request_game_controller.rb +++ b/app/controllers/request_game_controller.rb @@ -11,13 +11,12 @@ class RequestGameController < ApplicationController def play session[:request_game] = Time.now - old = InfoRequest.find_old_unclassified(:conditions => ["prominence = 'normal'"]) - @missing = old.size + @missing = InfoRequest.count_old_unclassified(:conditions => ["prominence = 'normal'"]) @total = InfoRequest.count @done = @total - @missing @percentage = (@done.to_f / @total.to_f * 10000).round / 100.0 - @requests = old.sort_by{ rand }.slice(0..2) + @requests = InfoRequest.get_random_old_unclassified(3) if @missing == 0 flash[:notice] = _('<p>All done! Thank you very much for your help.</p><p>There are <a href="{{helpus_url}}">more things you can do</a> to help {{site_name}}.</p>', @@ -25,12 +24,8 @@ class RequestGameController < ApplicationController :site_name => site_name) end - @league_table_28_days = InfoRequestEvent.make_league_table( - [ "event_type = 'status_update' and created_at >= ?", Time.now() - 28.days ] - )[0..10] - @league_table_all_time = InfoRequestEvent.make_league_table( - [ "event_type = 'status_update'"] - )[0..10] + @league_table_28_days = RequestClassification.league_table(10, [ "created_at >= ?", Time.now() - 28.days ]) + @league_table_all_time = RequestClassification.league_table(10) @play_urls = true end |