diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-29 22:40:00 +0200 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-29 22:40:00 +0200 |
commit | d4e070cfadcccfe503402dd5d0524ca102d372d4 (patch) | |
tree | 0782081eff38e53624daf6e1099ac47f9bb344c5 /app/models/milestone.rb | |
parent | ecdf778e80d3804a076061989b5abb2d6e1e5c19 (diff) | |
download | gitlab-ce-d4e070cfadcccfe503402dd5d0524ca102d372d4.tar.gz |
Improve styles. Add merge request completness to milestone percentage
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r-- | app/models/milestone.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb index b924dc5fb80..233270ed748 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -16,8 +16,16 @@ class Milestone < ActiveRecord::Base User.where(id: issues.pluck(:assignee_id)) end - def percent_complete + def issues_percent_complete ((self.issues.closed.count * 100) / self.issues.count).abs + end + + def merge_requests_percent_complete + ((self.merge_requests.closed.count * 100) / self.merge_requests.count).abs + end + + def percent_complete + (issues_percent_complete + merge_requests_percent_complete) / 2 rescue ZeroDivisionError 100 end |