From a7a41e6957ceef7acfcea891e53bb73f5ae3f1df Mon Sep 17 00:00:00 2001 From: Luke Baker Date: Tue, 4 Jan 2011 13:10:44 -0500 Subject: [PATCH] add rake task for updating all choice scores --- lib/tasks/test_api.rake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/tasks/test_api.rake b/lib/tasks/test_api.rake index a8b0874..fbbf043 100644 --- a/lib/tasks/test_api.rake +++ b/lib/tasks/test_api.rake @@ -11,11 +11,21 @@ namespace :test_api do :losses => (true_losses - choice.losses), :wins => (true_wins - choice.wins) choice.reload - choice.compute_score! + choice.score = choice.compute_score + choice.save(false) end end end + desc "Recomputes scores for all choices." + task :recompute_scores => :environment do + Choice.find_each do |choice| + choice.reload + choice.score = choice.compute_score + choice.save(false) + end + end + task :all => [:question_vote_consistency,:generate_density_information] desc "Don't run unless you know what you are doing" -- libgit2 0.21.2