Skip to content

Instantly share code, notes, and snippets.

@mdarby
Created January 4, 2009 16:17
Show Gist options
  • Save mdarby/43095 to your computer and use it in GitHub Desktop.
Save mdarby/43095 to your computer and use it in GitHub Desktop.
def percentage_complete(date = Date.today)
self.phases.inject(0.0) do |sum, phase|
percent_complete = phase.percentage_complete(date)
percent_complete = percent_complete ** 2 unless %w{X Y}.include?(phase.name)
sum += (percent_complete * phase.percentage_of_hours)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment