Updated Deliverable.progress
* Make it return 100 if there are no issues * Get rid of sum in favor of manually adding values * Expand the progress bar to 100% #1136
This commit is contained in:
@@ -17,9 +17,11 @@ class Deliverable < ActiveRecord::Base
|
||||
|
||||
# TODO LATER: Shouldn't require the default_done_ratio patch
|
||||
def progress
|
||||
total = self.issues.sum(&:estimated_hours)
|
||||
balance = 0.0
|
||||
return 100 unless self.issues.count > 0
|
||||
|
||||
total = self.issues.collect(&:estimated_hours).inject {|sum, n| sum + n}
|
||||
balance = 0.0
|
||||
|
||||
self.issues.each do |issue|
|
||||
balance += issue.status.default_done_ratio * issue.estimated_hours
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user