diff --git a/CHANGELOG b/CHANGELOG index 1b5427b5adc85f550c92102fb133454859cfcc01..356673cd5a55e48d81eb1796b22fd6ec13e848e0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ v 7.12.0 (unreleased) - Update Asciidoctor gem to version 1.5.2. (Jakub Jirutka) - Fix resolving of relative links to repository files in AsciiDoc documents. (Jakub Jirutka) - Use the user list from the target project in a merge request (Stan Hu) + - Fix new/empty milestones showing 100% completion value (Jonah Bishop) v 7.11.2 - no changes diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb index 7e4f16ebf167ee51bf45bd4cecc10d470fb980cc..ab055f6b80bf785341fae04cc03cb0692c485811 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 9bbb2bafb981c1398adf5cedf65e091145b0e40f..9c543b370238cc17ed145af62c8a4534b4703085 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 diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 45171e1bf6459a35e4b7c0a4e227cdfc2b9d69f4..eb73aa763fcb25b92bab216d13a86d6ac8ef61f8 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -47,7 +47,7 @@ describe Milestone do it "should recover from dividing by zero" do expect(milestone.issues).to receive(:count).and_return(0) - expect(milestone.percent_complete).to eq(100) + expect(milestone.percent_complete).to eq(0) end end