Merge pull request #1446 from sunny-b/master

Enable Style/DotPosition Rubocop cop
This commit is contained in:
Ana María Martínez Gómez 2017-04-07 11:21:34 +02:00 committed by GitHub
commit fd6d0bf39b
25 changed files with 143 additions and 142 deletions

View file

@ -58,16 +58,20 @@ class Cfp < ActiveRecord::Base
private
def before_end_of_conference
errors.
add(:end_date, "can't be after the conference end date (#{program.conference.end_date})") if program.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
if program.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
errors
.add(:end_date, "can't be after the conference end date (#{program.conference.end_date})")
end
errors.
add(:start_date, "can't be after the conference end date (#{program.conference.end_date})") if program.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
if program.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
errors
.add(:start_date, "can't be after the conference end date (#{program.conference.end_date})")
end
end
def start_after_end_date
errors.
add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
errors
.add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
end
def conference_id

View file

@ -180,8 +180,8 @@ class Conference < ActiveRecord::Base
if registration_period &&
registration_period.start_date &&
registration_period.end_date
weeks = Date.new(registration_period.start_date.year, 12, 31).
strftime('%W').to_i
weeks = Date.new(registration_period.start_date.year, 12, 31)
.strftime('%W').to_i
result = get_registration_end_week - get_registration_start_week + 1
end
@ -277,9 +277,9 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +hash+ -> user: submissions
def get_top_submitter(limit = 5)
submitter = EventUser.joins(:event).
where('event_role = ? and program_id = ?', 'submitter', Conference.find(id).program.id).
limit(limit).group(:user_id)
submitter = EventUser.joins(:event)
.where('event_role = ? and program_id = ?', 'submitter', Conference.find(id).program.id)
.limit(limit).group(:user_id)
counter = submitter.order('count_all desc').count
Conference.calculate_user_submission_hash(submitter, counter)
end
@ -461,13 +461,13 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +ActiveRecord+
def self.get_active_conferences_for_dashboard
result = Conference.where('start_date > ?', Time.now).
select('id, short_title, color, start_date')
result = Conference.where('start_date > ?', Time.now)
.select('id, short_title, color, start_date')
if result.empty?
result = Conference.
select('id, short_title, color, start_date').limit(2).
order(start_date: :desc)
result = Conference
.select('id, short_title, color, start_date').limit(2)
.order(start_date: :desc)
end
result
end

View file

@ -286,8 +286,8 @@ class Event < ActiveRecord::Base
end
def before_end_of_conference
errors.
add(:created_at, "can't be after the conference end date!") if program.conference && program.conference.end_date &&
errors
.add(:created_at, "can't be after the conference end date!") if program.conference && program.conference.end_date &&
(Date.today > program.conference.end_date)
end

View file

@ -10,15 +10,15 @@ class RegistrationPeriod < ActiveRecord::Base
private
def before_end_of_conference
errors.
add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
errors
.add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
errors.
add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
errors
.add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
end
def start_date_before_end_date
errors.
add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
errors
.add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
end
end