-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rake task to reset the cached votes counter
- Loading branch information
1 parent
96066ae
commit 2b9b78e
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |