Improved code layout.

This commit is contained in:
Martin Edenhofer 2015-09-08 16:03:11 +02:00
parent 55f702e42b
commit 14b5eade24

View file

@ -21,7 +21,7 @@ class Stats::TicketLoadMeasure
end end
if total != 0 if total != 0
load_measure_precent = ( count.to_f / (total.to_f/100) ).round(3) load_measure_precent = ( count.to_f / (total.to_f / 100) ).round(3)
end end
{ {
used_for_average: load_measure_precent, used_for_average: load_measure_precent,
@ -42,7 +42,7 @@ class Stats::TicketLoadMeasure
return result return result
end end
in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].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'
@ -57,7 +57,7 @@ class Stats::TicketLoadMeasure
end end
# convert result[:used_for_average] in percent to related total # convert result[:used_for_average] in percent to related total
result[:average_per_agent] = ( (result[:total].to_f/100) * result[:average_per_agent] ).round(1) result[:average_per_agent] = ( (result[:total].to_f / 100) * result[:average_per_agent] ).round(1)
result result
end end