Created
April 23, 2012 12:49
-
-
Save divins/2470718 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
SummariesOverview = lambda do | | |
satisfaction = 0 | |
covered = 0 | |
continue = 0 | |
satisfaction = 0 | |
result = {} | |
summaries.each do |summary| | |
satisfaction += summary.satisfaction.to_f | |
covered += summary.covered if summary.covered | |
continue += summary.continue if summary.continue | |
end | |
satisfaction = (satisfaction/summaries.count).round(2) | |
OpenStruct.new({ | |
satisfaction: satisfaction, | |
covered: covered, | |
continue: continue, | |
summaries: summaries | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment