Commit a7a41e6957ceef7acfcea891e53bb73f5ae3f1df
1 parent
c9c7499a
Exists in
master
and in
1 other branch
add rake task for updating all choice scores
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
lib/tasks/test_api.rake
... | ... | @@ -11,11 +11,21 @@ namespace :test_api do |
11 | 11 | :losses => (true_losses - choice.losses), |
12 | 12 | :wins => (true_wins - choice.wins) |
13 | 13 | choice.reload |
14 | - choice.compute_score! | |
14 | + choice.score = choice.compute_score | |
15 | + choice.save(false) | |
15 | 16 | end |
16 | 17 | end |
17 | 18 | end |
18 | 19 | |
20 | + desc "Recomputes scores for all choices." | |
21 | + task :recompute_scores => :environment do | |
22 | + Choice.find_each do |choice| | |
23 | + choice.reload | |
24 | + choice.score = choice.compute_score | |
25 | + choice.save(false) | |
26 | + end | |
27 | + end | |
28 | + | |
19 | 29 | task :all => [:question_vote_consistency,:generate_density_information] |
20 | 30 | |
21 | 31 | desc "Don't run unless you know what you are doing" | ... | ... |