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

  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

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

Remove unused task to reset the vote counters
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.
