mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #58 from colinPL/json_gen_error
(maint) Fix Divide by 0 Bug
This commit is contained in:
commit
a8ecd59014
1 changed files with 8 additions and 2 deletions
|
|
@ -347,8 +347,14 @@ module Vmpooler
|
||||||
result[:clone][:duration][:total] = total_clone_dur_day.reduce(:+).to_f
|
result[:clone][:duration][:total] = total_clone_dur_day.reduce(:+).to_f
|
||||||
|
|
||||||
# averages and other things.
|
# averages and other things.
|
||||||
result[:clone][:duration][:average] = result[:clone][:duration][:total] / result[:clone][:count][:total]
|
if result[:clone][:count][:total] != 0
|
||||||
result[:clone][:duration][:min], result[:clone][:duration][:max] = min_max_clone_times.minmax
|
result[:clone][:duration][:average] = result[:clone][:duration][:total] / result[:clone][:count][:total]
|
||||||
|
end
|
||||||
|
|
||||||
|
if min_max_clone_times.length > 0
|
||||||
|
result[:clone][:duration][:min], result[:clone][:duration][:max] = min_max_clone_times.minmax
|
||||||
|
end
|
||||||
|
|
||||||
result[:clone][:count][:min], result[:clone][:count][:max] = total_clones_per_day.minmax
|
result[:clone][:count][:min], result[:clone][:count][:max] = total_clones_per_day.minmax
|
||||||
result[:clone][:count][:average] = mean(total_clones_per_day)
|
result[:clone][:count][:average] = mean(total_clones_per_day)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue