Enable Style/SpaceAroundOperators Rubocop

Cleared all the offenses for Style/SpaceAroundOperators

Added a description for the Style/SpaceAroundOperators Rubocop.
This commit is contained in:
gotens1211 2017-02-01 20:47:35 +05:30
parent 945b4aac60
commit 4a9c971ec7
11 changed files with 21 additions and 34 deletions

View file

@ -160,7 +160,7 @@ class Conference < ActiveRecord::Base
result[state] = pad_array_left_not_kumulative(start_week, values)
end
end
result['Weeks'] = weeks > 0 ? (1..weeks).to_a : 0
result['Weeks'] = weeks > 0 ? (1..weeks).to_a : 0
end
result
end
@ -343,8 +343,8 @@ class Conference < ActiveRecord::Base
# * +hash+ -> hash
def registration_distribution
reg = registrations.includes(:user)
attended_value = { 'value' => reg.where(attended: true).count, 'color' => 'magenta' }
not_attended_value = { 'value' => reg.where.not(attended: true).count, 'color' => 'blue' }
attended_value = { 'value' => reg.where(attended: true).count, 'color' => 'magenta' }
not_attended_value = { 'value' => reg.where.not(attended: true).count, 'color' => 'blue' }
{ 'Attended' => attended_value, 'Not attended' => not_attended_value }
end
@ -360,7 +360,7 @@ class Conference < ActiveRecord::Base
def affiliation_distribution
counted_affiliations = registrations.joins(:user).group(:affiliation).count
result = {}
i=1
i = 1
others = 0
none = 0
counted_affiliations.each do |key, value|
@ -625,7 +625,7 @@ class Conference < ActiveRecord::Base
def hours_from_start_time(start_hour, end_hour)
current_time = Time.find_zone(timezone).now
current_hour = current_time.strftime('%H').to_i
(start_hour..(end_hour-1)).cover?(current_hour) ? current_hour - start_hour : 0
(start_hour..(end_hour - 1)).cover?(current_hour) ? current_hour - start_hour : 0
end
private
@ -641,7 +641,7 @@ class Conference < ActiveRecord::Base
# consecutive colors clearly different.
def next_color_component(component, i)
big_prime_numbers = {r: 113, g: 67, b: 151}
((i*big_prime_numbers[component])%239 + 16).to_s(16)
((i * big_prime_numbers[component]) % 239 + 16).to_s(16)
end
after_create do

View file

@ -135,7 +135,7 @@ class Event < ActiveRecord::Base
def process_confirmation
if program.conference.email_settings.send_on_confirmed_without_registration? &&
program.conference.email_settings.confirmed_without_registration_body &&
program.conference.email_settings.confirmed_without_registration_body &&
program.conference.email_settings.confirmed_without_registration_subject
if program.conference.registrations.where(user_id: submitter.id).first.nil?
Mailbot.confirm_reminder_mail(self).deliver_later

View file

@ -58,7 +58,7 @@ class Target < ActiveRecord::Base
numerator = conference.current_program_minutes
end
progress = (numerator / target_count.to_f * 100).round(0).to_s
progress = (numerator / target_count.to_f * 100).round(0).to_s
result = {
'target_name' => to_s,
'campaign_name' => campaign.name,

View file

@ -22,7 +22,7 @@ class Ticket < ActiveRecord::Base
def tickets_paid(user)
paid_tickets = quantity_bought_by(user, paid: true)
unpaid_tickets = quantity_bought_by(user, paid: false)
"#{paid_tickets}/#{paid_tickets+unpaid_tickets}"
"#{paid_tickets}/#{paid_tickets + unpaid_tickets}"
end
def quantity_bought_by(user, paid: false)
@ -44,7 +44,7 @@ class Ticket < ActiveRecord::Base
tickets.each do |ticket|
price = ticket.total_price(user, paid: paid)
if result
result += price unless price.zero?
result += price unless price.zero?
else
result = price
end