Commit ea838141 authored by Adam Niedzielski's avatar Adam Niedzielski

Use sum instead of map + inject

parent da1f5255
......@@ -9,9 +9,9 @@ module ConversationalDevelopmentIndex
end
def percentage_score
sum = features.map do |feature|
sum = features.sum do |feature|
metric.percentage_score(feature)
end.inject(:+)
end
sum / features.size.to_f
end
......
......@@ -138,7 +138,7 @@ module ConversationalDevelopmentIndex
end
def average_percentage_score
cards.map(&:percentage_score).inject(:+) / cards.size.to_f
cards.sum(&:percentage_score) / cards.size.to_f
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment