Files
grecia/lib/tasks/votes.rake
Javi Martín f15f250150 Remove unused task to reset the vote counters
This task was added in commit 2b9b78e38. According to the notes in the
pull request introducing the change:

> If you have had [map validations] in production, you might want to run
> the rake task votes:reset_vote_counter to reset the cached votes
> counter. Otherwise, until there is another vote for a proposal, the
> counter will not be updated, and there might be some votes which are
> not yet displayed

In short, this was a task that was introduced for a specific release and
had to be run manually. So we can remove it now.
2022-10-02 16:52:59 +02:00

17 lines
490 B
Ruby

namespace :votes do
desc "Resets hot_score to its new value"
task reset_hot_score: :environment do
models = [Debate, Proposal, Legislation::Proposal]
models.each do |model|
print "Updating votes hot_score for #{model}s"
model.find_each do |resource|
new_hot_score = resource.calculate_hot_score
resource.update_columns(hot_score: new_hot_score, updated_at: Time.current)
end
puts ""
end
puts "Task finished 🎉 "
end
end