sqm-dashboards/config/initializers/array_monkey_patches.rb
Nelson Jovel c475744939 Modify score calculations. Ignore any survey item scores of 0.
Never include zero when performing calculations for scores.
2022-04-20 13:49:27 -07:00

11 lines
180 B
Ruby

module ArrayMonkeyPatches
def average
sum.to_f / size
end
def remove_zeros
reject { |item| item == 0 || item.to_f.nan? }
end
end
Array.include ArrayMonkeyPatches