Added some syntactic suguar (used in rubocop cops).
This commit is contained in:
parent
b229d024f5
commit
00cffad79e
13 changed files with 21 additions and 21 deletions
|
@ -89,7 +89,7 @@ class LongPollingController < ApplicationController
|
|||
sleep 0.25
|
||||
}
|
||||
#sleep 2
|
||||
if count == 0
|
||||
if count.zero?
|
||||
render json: { event: 'pong' }
|
||||
return
|
||||
end
|
||||
|
|
|
@ -442,7 +442,7 @@ returns
|
|||
# do lookup with == to handle case insensitive databases
|
||||
records = where(login: data[:login])
|
||||
records.each {|loop_record|
|
||||
if loop_record.login.casecmp(data[:login]) == 0
|
||||
if loop_record.login.casecmp(data[:login]).zero?
|
||||
loop_record.update_attributes(data)
|
||||
return loop_record
|
||||
end
|
||||
|
@ -455,7 +455,7 @@ returns
|
|||
# do lookup with == to handle case insensitive databases
|
||||
records = where(email: data[:email])
|
||||
records.each {|loop_record|
|
||||
if loop_record.email.casecmp(data[:email]) == 0
|
||||
if loop_record.email.casecmp(data[:email]).zero?
|
||||
loop_record.update_attributes(data)
|
||||
return loop_record
|
||||
end
|
||||
|
@ -468,7 +468,7 @@ returns
|
|||
# do lookup with == to handle case insensitive databases
|
||||
records = where(locale: data[:locale])
|
||||
records.each {|loop_record|
|
||||
if loop_record.locale.casecmp(data[:locale]) == 0
|
||||
if loop_record.locale.casecmp(data[:locale]).zero?
|
||||
loop_record.update_attributes(data)
|
||||
return loop_record
|
||||
end
|
||||
|
|
|
@ -182,7 +182,7 @@ returns
|
|||
end
|
||||
@imap.expunge()
|
||||
disconnect
|
||||
if count == 0
|
||||
if count.zero?
|
||||
Rails.logger.info ' - no message'
|
||||
end
|
||||
Rails.logger.info 'done'
|
||||
|
|
|
@ -151,7 +151,7 @@ returns
|
|||
end
|
||||
end
|
||||
disconnect
|
||||
if count == 0
|
||||
if count.zero?
|
||||
Rails.logger.info ' - no message'
|
||||
end
|
||||
Rails.logger.info 'done'
|
||||
|
|
|
@ -193,7 +193,7 @@ class Channel::EmailParser
|
|||
# not multipart email
|
||||
|
||||
# text part only
|
||||
elsif !mail.mime_type || mail.mime_type.to_s == '' || mail.mime_type.to_s.casecmp('text/plain') == 0
|
||||
elsif !mail.mime_type || mail.mime_type.to_s == '' || mail.mime_type.to_s.casecmp('text/plain').zero?
|
||||
data[:body] = mail.body.decoded
|
||||
data[:body] = Encode.conv(mail.charset, data[:body])
|
||||
|
||||
|
@ -204,7 +204,7 @@ class Channel::EmailParser
|
|||
# html part only, convert to text and add it as attachment
|
||||
else
|
||||
filename = '-no name-'
|
||||
if mail.mime_type.to_s.casecmp('text/html') == 0
|
||||
if mail.mime_type.to_s.casecmp('text/html').zero?
|
||||
filename = 'message.html'
|
||||
data[:body] = mail.body.decoded
|
||||
data[:body] = Encode.conv(mail.charset, data[:body])
|
||||
|
|
|
@ -46,7 +46,7 @@ class Chat < ApplicationModel
|
|||
|
||||
# check if agents are available
|
||||
available_agents = Chat::Agent.where(active: true).where('updated_at > ?', Time.zone.now - 2.minutes).count
|
||||
if available_agents == 0
|
||||
if available_agents.zero?
|
||||
return { state: 'offline' }
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Encode
|
|||
end
|
||||
|
||||
# validate already existing utf8 strings
|
||||
if charset.casecmp('utf8') == 0 || charset.casecmp('utf-8') == 0
|
||||
if charset.casecmp('utf8').zero? || charset.casecmp('utf-8').zero?
|
||||
begin
|
||||
|
||||
# return if encoding is valid
|
||||
|
|
|
@ -635,7 +635,7 @@ module Import::Zendesk
|
|||
|
||||
zendesk_attachments = zendesk_article.attachments
|
||||
|
||||
next if zendesk_attachments.size == 0
|
||||
next if zendesk_attachments.size.zero?
|
||||
|
||||
local_attachments = local_article.attachments
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ returns
|
|||
next if !model_attributes[:attributes].include?(item)
|
||||
|
||||
count = model_class.where("#{item} = ?", object_id).count
|
||||
next if count == 0
|
||||
next if count.zero?
|
||||
if !references[model_class.to_s][item]
|
||||
references[model_class.to_s][item] = 0
|
||||
end
|
||||
|
@ -144,7 +144,7 @@ returns
|
|||
|
||||
if reflection_value.options[:class_name] == object_name
|
||||
count = model_class.where("#{col_name} = ?", object_id).count
|
||||
next if count == 0
|
||||
next if count.zero?
|
||||
if !references[model_class.to_s][col_name]
|
||||
references[model_class.to_s][col_name] = 0
|
||||
end
|
||||
|
@ -156,7 +156,7 @@ returns
|
|||
next if reflection_value.name != object_name.downcase.to_sym
|
||||
|
||||
count = model_class.where("#{col_name} = ?", object_id).count
|
||||
next if count == 0
|
||||
next if count.zero?
|
||||
if !references[model_class.to_s][col_name]
|
||||
references[model_class.to_s][col_name] = 0
|
||||
end
|
||||
|
|
|
@ -242,7 +242,7 @@ class Report::Base
|
|||
time_total = time_total + diff
|
||||
tickets += 1
|
||||
}
|
||||
if time_total == 0 || tickets == 0
|
||||
if time_total.zero? || tickets.zero?
|
||||
tickets = -0.001
|
||||
else
|
||||
tickets = time_total / tickets / 60
|
||||
|
@ -279,7 +279,7 @@ class Report::Base
|
|||
time_min = diff
|
||||
end
|
||||
}
|
||||
tickets = if time_min == 0
|
||||
tickets = if time_min.zero?
|
||||
-0.001
|
||||
else
|
||||
(time_min / 60).to_i
|
||||
|
@ -317,7 +317,7 @@ class Report::Base
|
|||
time_max = diff
|
||||
end
|
||||
}
|
||||
tickets = if time_max == 0
|
||||
tickets = if time_max.zero?
|
||||
-0.001
|
||||
else
|
||||
(time_max / 60).to_i
|
||||
|
|
|
@ -67,7 +67,7 @@ class Stats::TicketChannelDistribution
|
|||
channels.each {|channel|
|
||||
count = result[channel[:sender].to_sym][:inbound]
|
||||
#puts "#{channel.inspect}:in/#{result.inspect}:#{count}"
|
||||
in_process_precent = if count == 0
|
||||
in_process_precent = if count.zero?
|
||||
0
|
||||
else
|
||||
(count * 1000) / ((total_in * 1000) / 100)
|
||||
|
@ -75,7 +75,7 @@ class Stats::TicketChannelDistribution
|
|||
result[channel[:sender].to_sym][:inbound_in_percent] = in_process_precent
|
||||
|
||||
count = result[channel[:sender].to_sym][:outbound]
|
||||
out_process_precent = if count == 0
|
||||
out_process_precent = if count.zero?
|
||||
0
|
||||
else
|
||||
(count * 1000) / ((total_out * 1000) / 100)
|
||||
|
|
|
@ -21,7 +21,7 @@ class Stats::TicketEscalation
|
|||
|
||||
average = '-'
|
||||
state = 'supergood'
|
||||
state = if own_escalated == 0
|
||||
state = if own_escalated.zero?
|
||||
'supergood'
|
||||
elsif own_escalated <= 1
|
||||
'good'
|
||||
|
|
|
@ -206,7 +206,7 @@ EventMachine.run {
|
|||
}
|
||||
|
||||
EventMachine.add_periodic_timer(0.4) {
|
||||
next if @clients.size == 0
|
||||
next if @clients.size.zero?
|
||||
#log 'debug', 'checking for data to send...'
|
||||
@clients.each { |client_id, client|
|
||||
next if client[:disconnect]
|
||||
|
|
Loading…
Reference in a new issue