fix rubocop issue

This commit is contained in:
Shlok Srivastava 2017-04-28 10:22:41 +00:00
parent e92114a257
commit e3174fa277
4 changed files with 10 additions and 10 deletions

View file

@ -3,7 +3,7 @@ class VotableField < ActiveRecord::Base
validates :title, :votable_type, :stars, presence: true validates :title, :votable_type, :stars, presence: true
validates :title, uniqueness: { scope: :votable_type, message: 'already exsists for the selected votable type' } validates :title, uniqueness: { scope: :votable_type, message: 'already exsists for the selected votable type' }
VALID_VOTABLE_TYPES = %w(Event).freeze VALID_VOTABLE_TYPES = %w[Event].freeze
# ratyrate does not allow criterias to have spaces in them # ratyrate does not allow criterias to have spaces in them
validate :no_spaces_in_title validate :no_spaces_in_title
validate :correct_votable_type validate :correct_votable_type

View file

@ -6,7 +6,7 @@ namespace :votes do
VotableField.create(title: 'Overall', conference_id: conf.id, for_admin: true, stars: conf.program.rating, votable_type: 'Event') VotableField.create(title: 'Overall', conference_id: conf.id, for_admin: true, stars: conf.program.rating, votable_type: 'Event')
Event.all.each do |event| Event.all.each do |event|
votes = Vote.where(event_id: event.id) votes = Vote.where(event_id: event.id)
break unless votes.present? break if votes.blank?
avg_votes = votes.pluck(:rating).sum / votes.count avg_votes = votes.pluck(:rating).sum / votes.count
votes.each do |vote| 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)