Commit b166bd5cd3435765f74d8bb6d25ea2883adbc669
1 parent
1969c03c
Exists in
master
and in
1 other branch
generalize db update task to accept question_ids
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
lib/tasks/prune_db.rake
... | ... | @@ -211,7 +211,13 @@ namespace :prune_db do |
211 | 211 | |
212 | 212 | desc "Update cached values for prompts on left and right for choices." |
213 | 213 | task :update_cached_prompts_on_left_right => :environment do |
214 | - Question.all.each do |question| | |
214 | + question_ids = ENV["question_ids"].split(/[\s,]+/) if ENV["question_ids"] | |
215 | + if !question_ids.blank? | |
216 | + questions = Question.find(question_ids) | |
217 | + else | |
218 | + questions = Question.all | |
219 | + end | |
220 | + questions.each do |question| | |
215 | 221 | question.choices.each do |choice| |
216 | 222 | choice.reload |
217 | 223 | Choice.update_counters choice.id, | ... | ... |