Improved show average, is now related to total based on user permissions.

This commit is contained in:
Martin Edenhofer 2015-09-08 15:10:29 +02:00
parent 0ea767707f
commit 0dee1e64f7

View file

@ -24,7 +24,7 @@ class Stats::TicketLoadMeasure
load_measure_precent = ( count.to_f / (total.to_f/100) ).round(1) load_measure_precent = ( count.to_f / (total.to_f/100) ).round(1)
end end
{ {
used_for_average: count, used_for_average: load_measure_precent,
average_per_agent: average, average_per_agent: average,
percent: load_measure_precent, percent: load_measure_precent,
state: state, state: state,
@ -42,7 +42,7 @@ class Stats::TicketLoadMeasure
return result return result
end end
in_percent = ( result[:used_for_average].to_f / (result[:total].to_f/100) ).round(1) in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f/100) ).round(1)
result[:average_per_agent_in_percent] = in_percent result[:average_per_agent_in_percent] = in_percent
if in_percent >= 90 if in_percent >= 90
result[:state] = 'supergood' result[:state] = 'supergood'
@ -56,6 +56,9 @@ class Stats::TicketLoadMeasure
result[:state] = 'superbad' result[:state] = 'superbad'
end end
# convert result[:used_for_average] in percent to related total
result[:average_per_agent] = ( (result[:total].to_f/100) * result[:used_for_average] ).round(1)
result result
end end