Applied rubocop.
This commit is contained in:
parent
c2297ff210
commit
0db8519cab
3 changed files with 8 additions and 8 deletions
|
@ -32,7 +32,7 @@ returns:
|
|||
)
|
||||
elsif category == 'work_on'
|
||||
return Ticket::State.where(
|
||||
state_type_id: Ticket::StateType.where( name: ['new', 'open'] )
|
||||
state_type_id: Ticket::StateType.where( name: %w(new open) )
|
||||
)
|
||||
elsif category == 'work_on_all'
|
||||
return Ticket::State.where(
|
||||
|
@ -40,7 +40,7 @@ returns:
|
|||
)
|
||||
elsif category == 'closed'
|
||||
return Ticket::State.where(
|
||||
state_type_id: Ticket::StateType.where( name: ['closed'] )
|
||||
state_type_id: Ticket::StateType.where( name: %w(closed) )
|
||||
)
|
||||
end
|
||||
fail "Unknown category '#{category}'"
|
||||
|
|
|
@ -43,9 +43,9 @@ returns
|
|||
|
||||
# calculate average
|
||||
backend_average_sum = {}
|
||||
user_result.each {|user_id, data|
|
||||
user_result.each {|_user_id, data|
|
||||
data.each {|backend_model, backend_result|
|
||||
next if !backend_result.has_key?(:used_for_average)
|
||||
next if !backend_result.key?(:used_for_average)
|
||||
if !backend_average_sum[backend_model]
|
||||
backend_average_sum[backend_model] = 0
|
||||
end
|
||||
|
@ -56,10 +56,10 @@ returns
|
|||
# generate average stats
|
||||
backend_average_sum.each {|backend_model_average, result|
|
||||
average = ( result.to_f / agent_count.to_f ).round(1)
|
||||
user_result.each {|user_id, data|
|
||||
user_result.each {|_user_id, data|
|
||||
data.each {|backend_model_data, backend_result|
|
||||
next if backend_model_data != backend_model_average
|
||||
next if !backend_result.has_key?(:used_for_average)
|
||||
next if !backend_result.key?(:used_for_average)
|
||||
backend_result[:average_per_agent] = average
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,14 +20,14 @@ class Stats::TicketInProcess
|
|||
closed_state_ids = Ticket::State.by_category('closed').map(&:id)
|
||||
closed_ticket_ids = Ticket.select('id').where(
|
||||
'owner_id = ? AND state_id IN (?) AND close_time > ?',
|
||||
user.id, closed_state_ids, Time.zone.now-1.day
|
||||
user.id, closed_state_ids, Time.zone.now - 1.day
|
||||
).limit(100).map(&:id)
|
||||
|
||||
# get all tickets which I changed to pending action
|
||||
pending_action_state_ids = Ticket::State.by_category('pending_action').map(&:id)
|
||||
pending_action_ticket_ids = Ticket.select('id').where(
|
||||
'owner_id = ? AND state_id IN (?) AND updated_at > ?',
|
||||
user.id, pending_action_state_ids, Time.zone.now-1.day
|
||||
user.id, pending_action_state_ids, Time.zone.now - 1.day
|
||||
).limit(100).map(&:id)
|
||||
|
||||
all_ticket_ids = own_ticket_ids.concat(closed_ticket_ids).concat(pending_action_ticket_ids).uniq
|
||||
|
|
Loading…
Reference in a new issue