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'
|
elsif category == 'work_on'
|
||||||
return Ticket::State.where(
|
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'
|
elsif category == 'work_on_all'
|
||||||
return Ticket::State.where(
|
return Ticket::State.where(
|
||||||
|
@ -40,7 +40,7 @@ returns:
|
||||||
)
|
)
|
||||||
elsif category == 'closed'
|
elsif category == 'closed'
|
||||||
return Ticket::State.where(
|
return Ticket::State.where(
|
||||||
state_type_id: Ticket::StateType.where( name: ['closed'] )
|
state_type_id: Ticket::StateType.where( name: %w(closed) )
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
fail "Unknown category '#{category}'"
|
fail "Unknown category '#{category}'"
|
||||||
|
|
|
@ -43,9 +43,9 @@ returns
|
||||||
|
|
||||||
# calculate average
|
# calculate average
|
||||||
backend_average_sum = {}
|
backend_average_sum = {}
|
||||||
user_result.each {|user_id, data|
|
user_result.each {|_user_id, data|
|
||||||
data.each {|backend_model, backend_result|
|
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]
|
if !backend_average_sum[backend_model]
|
||||||
backend_average_sum[backend_model] = 0
|
backend_average_sum[backend_model] = 0
|
||||||
end
|
end
|
||||||
|
@ -56,10 +56,10 @@ returns
|
||||||
# generate average stats
|
# generate average stats
|
||||||
backend_average_sum.each {|backend_model_average, result|
|
backend_average_sum.each {|backend_model_average, result|
|
||||||
average = ( result.to_f / agent_count.to_f ).round(1)
|
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|
|
data.each {|backend_model_data, backend_result|
|
||||||
next if backend_model_data != backend_model_average
|
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
|
backend_result[:average_per_agent] = average
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,14 @@ class Stats::TicketInProcess
|
||||||
closed_state_ids = Ticket::State.by_category('closed').map(&:id)
|
closed_state_ids = Ticket::State.by_category('closed').map(&:id)
|
||||||
closed_ticket_ids = Ticket.select('id').where(
|
closed_ticket_ids = Ticket.select('id').where(
|
||||||
'owner_id = ? AND state_id IN (?) AND close_time > ?',
|
'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)
|
).limit(100).map(&:id)
|
||||||
|
|
||||||
# get all tickets which I changed to pending action
|
# get all tickets which I changed to pending action
|
||||||
pending_action_state_ids = Ticket::State.by_category('pending_action').map(&:id)
|
pending_action_state_ids = Ticket::State.by_category('pending_action').map(&:id)
|
||||||
pending_action_ticket_ids = Ticket.select('id').where(
|
pending_action_ticket_ids = Ticket.select('id').where(
|
||||||
'owner_id = ? AND state_id IN (?) AND updated_at > ?',
|
'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)
|
).limit(100).map(&:id)
|
||||||
|
|
||||||
all_ticket_ids = own_ticket_ids.concat(closed_ticket_ids).concat(pending_action_ticket_ids).uniq
|
all_ticket_ids = own_ticket_ids.concat(closed_ticket_ids).concat(pending_action_ticket_ids).uniq
|
||||||
|
|
Loading…
Reference in a new issue