diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bdbc839fd..b732d50aa 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -602,7 +602,7 @@ class ApplicationController < ActionController::Base per_page = 500 end - generic_objects = if offset > 0 + generic_objects = if offset.positive? object.limit(params[:per_page]).order(id: 'ASC').offset(offset).limit(limit) else object.all.order(id: 'ASC').offset(offset).limit(limit) diff --git a/app/controllers/first_steps_controller.rb b/app/controllers/first_steps_controller.rb index 682c0cff3..d86bd8527 100644 --- a/app/controllers/first_steps_controller.rb +++ b/app/controllers/first_steps_controller.rb @@ -24,19 +24,19 @@ class FirstStepsController < ApplicationController from_active = true end twitter_active = false - if Channel.where(area: 'Twitter::Account').count > 0 + if Channel.where(area: 'Twitter::Account').count.positive? twitter_active = true end facebook_active = false - if Channel.where(area: 'Facebook::Account').count > 0 + if Channel.where(area: 'Facebook::Account').count.positive? facebook_active = true end email_active = false - if Channel.where(area: 'Email::Account').count > 0 + if Channel.where(area: 'Email::Account').count.positive? email_active = true end text_module_active = false - if TextModule.count > 0 + if TextModule.count.positive? text_module_active = true end macro_active = false diff --git a/app/models/application_model.rb b/app/models/application_model.rb index cac10c34e..77d4a7c7a 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -236,7 +236,7 @@ returns next if !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) end next diff --git a/app/models/avatar.rb b/app/models/avatar.rb index 0f271a9c7..396683bb7 100644 --- a/app/models/avatar.rb +++ b/app/models/avatar.rb @@ -380,7 +380,7 @@ returns: object_lookup_id: object_id, o_id: o_id, ).count - return if count > 0 + return if count.positive? Avatar.create( o_id: o_id, diff --git a/app/models/job.rb b/app/models/job.rb index 883321ff4..4f13cf913 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -100,7 +100,7 @@ class Job < ApplicationModel def next_run_at_calculate(time = Time.zone.now) if last_run_at diff = time - last_run_at - if diff > 0 + if diff.positive? time = time + 10.minutes end end diff --git a/app/models/karma/activity_log.rb b/app/models/karma/activity_log.rb index 1667139cf..40ef9ba81 100644 --- a/app/models/karma/activity_log.rb +++ b/app/models/karma/activity_log.rb @@ -27,7 +27,7 @@ class Karma::ActivityLog < ApplicationModel end local_score_total = score_total + activity.score - if local_score_total < 0 + if local_score_total.negative? local_score_total = 0 end diff --git a/app/models/user.rb b/app/models/user.rb index 35d614478..a4652568f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -384,11 +384,11 @@ returns end list.each { |preferences| next if preferences[:selectable] == false - Cache.write(key, true, expires_in: 20.seconds) + Cache.write(key, true, expires_in: 10.seconds) return true } } - Cache.write(key, false, expires_in: 20.seconds) + Cache.write(key, false, expires_in: 10.seconds) false end diff --git a/lib/import/otrs.rb b/lib/import/otrs.rb index 49ad0d0f5..0bc0fd7f2 100644 --- a/lib/import/otrs.rb +++ b/lib/import/otrs.rb @@ -1085,7 +1085,7 @@ module Import::OTRS # check if login is already used 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]}" end