diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-10-24 10:50:25 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-10-24 10:50:25 +0100 |
commit | 898593338c9de54ce256c5baf39ebd6613a2eb4d (patch) | |
tree | 5234be633f185eea3cc0488d878bda5714991a0b /lib/tasks | |
parent | b170c18a5f3a776006649145267724193c54e397 (diff) | |
parent | 280b3fd57e6f21d1cd09548411fc1dafd794cc1d (diff) |
Merge branch 'wdtk' of ssh://git.mysociety.org/data/git/public/alaveteli into wdtk
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/stats.rake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake index 4eda27289..eb36204c6 100644 --- a/lib/tasks/stats.rake +++ b/lib/tasks/stats.rake @@ -94,7 +94,7 @@ namespace :stats do desc 'Update statistics in the public_bodies table' task :update_public_bodies_stats => :environment do verbose = ENV['VERBOSE'] == '1' - PublicBody.all.each do |public_body| + PublicBody.find_each(:batch_size => 10) do |public_body| puts "Counting overdue requests for #{public_body.name}" if verbose # Look for values of 'waiting_response_overdue' and @@ -102,7 +102,8 @@ namespace :stats do # described_state column, and instead need to be calculated: overdue_count = 0 very_overdue_count = 0 - InfoRequest.find_each(:conditions => {:public_body_id => public_body.id}) do |ir| + InfoRequest.find_each(:batch_size => 200, + :conditions => {:public_body_id => public_body.id}) do |ir| case ir.calculate_status when 'waiting_response_very_overdue' very_overdue_count += 1 |