Applies rubocop for ruby 2.3.1.

This commit is contained in:
Martin Edenhofer 2016-10-24 23:59:18 +02:00
parent 35a486f32b
commit 1ddbb5d59e
8 changed files with 12 additions and 12 deletions

View file

@ -602,7 +602,7 @@ class ApplicationController < ActionController::Base
per_page = 500 per_page = 500
end end
generic_objects = if offset > 0 generic_objects = if offset.positive?
object.limit(params[:per_page]).order(id: 'ASC').offset(offset).limit(limit) object.limit(params[:per_page]).order(id: 'ASC').offset(offset).limit(limit)
else else
object.all.order(id: 'ASC').offset(offset).limit(limit) object.all.order(id: 'ASC').offset(offset).limit(limit)

View file

@ -24,19 +24,19 @@ class FirstStepsController < ApplicationController
from_active = true from_active = true
end end
twitter_active = false twitter_active = false
if Channel.where(area: 'Twitter::Account').count > 0 if Channel.where(area: 'Twitter::Account').count.positive?
twitter_active = true twitter_active = true
end end
facebook_active = false facebook_active = false
if Channel.where(area: 'Facebook::Account').count > 0 if Channel.where(area: 'Facebook::Account').count.positive?
facebook_active = true facebook_active = true
end end
email_active = false email_active = false
if Channel.where(area: 'Email::Account').count > 0 if Channel.where(area: 'Email::Account').count.positive?
email_active = true email_active = true
end end
text_module_active = false text_module_active = false
if TextModule.count > 0 if TextModule.count.positive?
text_module_active = true text_module_active = true
end end
macro_active = false macro_active = false

View file

@ -236,7 +236,7 @@ returns
next if !item[:name] next if !item[:name]
attributes[assoc.name.to_s].push item[:name] attributes[assoc.name.to_s].push item[:name]
} }
if ref.count > 0 && attributes[assoc.name.to_s].empty? if ref.count.positive? && attributes[assoc.name.to_s].empty?
attributes.delete(assoc.name.to_s) attributes.delete(assoc.name.to_s)
end end
next next

View file

@ -380,7 +380,7 @@ returns:
object_lookup_id: object_id, object_lookup_id: object_id,
o_id: o_id, o_id: o_id,
).count ).count
return if count > 0 return if count.positive?
Avatar.create( Avatar.create(
o_id: o_id, o_id: o_id,

View file

@ -100,7 +100,7 @@ class Job < ApplicationModel
def next_run_at_calculate(time = Time.zone.now) def next_run_at_calculate(time = Time.zone.now)
if last_run_at if last_run_at
diff = time - last_run_at diff = time - last_run_at
if diff > 0 if diff.positive?
time = time + 10.minutes time = time + 10.minutes
end end
end end

View file

@ -27,7 +27,7 @@ class Karma::ActivityLog < ApplicationModel
end end
local_score_total = score_total + activity.score local_score_total = score_total + activity.score
if local_score_total < 0 if local_score_total.negative?
local_score_total = 0 local_score_total = 0
end end

View file

@ -384,11 +384,11 @@ returns
end end
list.each { |preferences| list.each { |preferences|
next if preferences[:selectable] == false next if preferences[:selectable] == false
Cache.write(key, true, expires_in: 20.seconds) Cache.write(key, true, expires_in: 10.seconds)
return true return true
} }
} }
Cache.write(key, false, expires_in: 20.seconds) Cache.write(key, false, expires_in: 10.seconds)
false false
end end

View file

@ -1085,7 +1085,7 @@ module Import::OTRS
# check if login is already used # check if login is already used
login_in_use = User.where( "login = ? AND id != #{user_new[:id]}", user_new[:login].downcase ).count login_in_use = User.where( "login = ? AND id != #{user_new[:id]}", user_new[:login].downcase ).count
if login_in_use > 0 if login_in_use.positive?
user_new[:login] = "#{user_new[:login]}_#{user_new[:id]}" user_new[:login] = "#{user_new[:login]}_#{user_new[:id]}"
end end