fix rubocop issue
This commit is contained in:
parent
e92114a257
commit
e3174fa277
4 changed files with 10 additions and 10 deletions
|
|
@ -5,16 +5,16 @@ namespace :votes do
|
|||
Conference.all.each do |conf|
|
||||
VotableField.create(title: 'Overall', conference_id: conf.id, for_admin: true, stars: conf.program.rating, votable_type: 'Event')
|
||||
Event.all.each do |event|
|
||||
votes = Vote.where(event_id: event.id)
|
||||
break unless votes.present?
|
||||
votes = Vote.where(event_id: event.id)
|
||||
break if votes.blank?
|
||||
avg_votes = votes.pluck(:rating).sum / votes.count
|
||||
votes.each do |vote|
|
||||
Rate.create(dimension: 'Overall', rater_id: vote.user_id, rateable_type: 'Event', stars: vote.rating, rateable_id: event.id )
|
||||
Rate.create(dimension: 'Overall', rater_id: vote.user_id, rateable_type: 'Event', stars: vote.rating, rateable_id: event.id)
|
||||
end
|
||||
RatingCache.create(cacheable_id: event.id, cacheable_type: 'Event', avg: avg_votes, qty: votes.count, dimension: 'Overall')
|
||||
end
|
||||
end
|
||||
end
|
||||
puts 'All done!'
|
||||
puts 'All done!'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue