diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:59 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:59 +0100 |
commit | 1e2b6a8acf65f48edb1e03f4f024db9644765897 (patch) | |
tree | d8b87e874e383fcac83e29cf05673606c946fc4e /app/controllers/request_game_controller.rb | |
parent | bd94b0390fcfba53bee7d546227e94e860f37c17 (diff) | |
parent | 6d3d9d9846fa905e606f0a2aa6f1ec32122f4850 (diff) |
Merge branch 'wdtk' of git.mysociety.org:/data/git/public/alaveteli into wdtk
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 |