Add rake task to reset the cached votes counter

This commit is contained in:
rgarcia
2017-12-26 12:40:26 +01:00
parent 96066aee44
commit 2b9b78e38e

16
lib/tasks/votes.rake Normal file
View File

@@ -0,0 +1,16 @@
namespace :votes do
desc "Resets cached_votes_up counter to its latest value"
task reset_vote_counter: :environment do
models = [Proposal, Budget::Investment]
models.each do |model|
model.find_each do |resource|
resource.update_cached_votes
print "."
end
end
end
end