Fix rubocop offenses

This commit is contained in:
Prommah 2015-11-05 08:25:54 +00:00
parent 6e9b84fdee
commit 1b0de57cc3

View file

@ -116,9 +116,9 @@ class Match < ActiveRecord::Base
group: "month", group: "month",
order: "month_n" order: "month_n"
validates_presence_of :contester1, :contester2, :contest validates :contester1, :contester2, :contest, presence: true
validates_format_of [:score1, :score2], with: /\A[0-9]\z/, allow_nil: true validates :score1, :score2, format: /\A[0-9]\z/, allow_nil: true
validates_length_of :report, maximum: 64_000, allow_blank: true validates :report, length: { maximum: 64_000 }, allow_blank: true
before_create :set_hltv before_create :set_hltv
after_create :send_notifications after_create :send_notifications
@ -193,7 +193,7 @@ class Match < ActiveRecord::Base
end end
def send_notifications def send_notifications
Profile.all(include: :user, conditions: "notify_any_match = 1").each do |p| Profile.all(include: :user, conditions: "notify_any_match = 1").find_each do |p|
Notifications.match p.user, self if p.user Notifications.match p.user, self if p.user
end end
contester2.team.teamers.active.each do |teamer| contester2.team.teamers.active.each do |teamer|
@ -288,8 +288,8 @@ class Match < ActiveRecord::Base
end end
def hltv_record(addr, pwd) def hltv_record(addr, pwd)
if (match_time - MATCH_LENGTH * 10) > DateTime.now || if (match_time - MATCH_LENGTH * 10) > DateTime.now.utc ||
(match_time + MATCH_LENGTH * 10) < DateTime.now (match_time + MATCH_LENGTH * 10) < DateTime.now.utc
raise Error, I18n.t(:hltv_request_20) raise Error, I18n.t(:hltv_request_20)
end end
if hltv && hltv.recording if hltv && hltv.recording