diff options
author | Jonah Bishop <git@borngeek.com> | 2015-05-26 21:44:04 +0300 |
---|---|---|
committer | Jonah Bishop <git@borngeek.com> | 2015-05-26 21:57:53 +0300 |
commit | 8b92946b5407be42caa1e32a978555b94465905c (patch) | |
tree | 046a16247090838a6b2ab365f3d5961b2a7983ad /app/models | |
parent | b5ea355078589f5002e3601333130350f1a37678 (diff) |
Change percent_complete rescue value from 100 to 0
The percent_complete method returns a value of 100 when a
ZeroDivisionError occurs. That seems like a very strange default for an
error case, and results in a bug when a milestone has no corresponding
issues (new, empty milestones show 100% completion). This commit changes
the rescue value to 0, and subsequently fixes #1656, which reported this
problem.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/group_milestone.rb | 2 | ||||
-rw-r--r-- | app/models/milestone.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb index 7e4f16ebf16..ab055f6b80b 100644 --- a/app/models/group_milestone.rb +++ b/app/models/group_milestone.rb @@ -44,7 +44,7 @@ class GroupMilestone def percent_complete ((closed_items_count * 100) / total_items_count).abs rescue ZeroDivisionError - 100 + 0 end def state diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 9bbb2bafb98..9c543b37023 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -66,7 +66,7 @@ class Milestone < ActiveRecord::Base def percent_complete ((closed_items_count * 100) / total_items_count).abs rescue ZeroDivisionError - 100 + 0 end def expires_at |