Add task to regenerate ballot_lines_count cache
We've added this column recently to `budget_ballots`, and we use it to calculate stats.
This commit is contained in:
8
lib/tasks/regenerate_ballot_lines_cache.rake
Normal file
8
lib/tasks/regenerate_ballot_lines_cache.rake
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace :budgets do
|
||||
desc "Regenerate ballot_lines_count cache"
|
||||
task calculate_ballot_lines: :environment do
|
||||
Budget::Ballot.find_each do |ballot|
|
||||
Budget::Ballot.reset_counters ballot.id, :lines
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user