Adds a rake task to calculate the confidence score of all the comments in the system

This commit is contained in:
kikito
2015-10-28 17:23:04 +01:00
parent f5d9ea4357
commit 4aa364a561

View File

@@ -6,4 +6,11 @@ namespace :comments do
Proposal.all.pluck(:id).each{ |id| Proposal.reset_counters(id, :comments) }
end
desc "Recalculates all the comment confidence scores (used for sorting comments)"
task confidence_score: :environment do
Comment.find_in_batches do |comments|
comments.each(&:save)
end
end
end