]> source.dussan.org Git - redmine.git/commitdiff
The progress exceeding 99.5% is displayed as 100% (#27848).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 8 Jan 2018 22:35:59 +0000 (22:35 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 8 Jan 2018 22:35:59 +0000 (22:35 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17169 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
test/unit/issue_subtasking_test.rb

index ae7267deb2b3022a114a2e44930fa0b068b033fb..7ab8ae9c90a814b546d37768d59765ecca11166c 100644 (file)
@@ -1704,7 +1704,7 @@ class Issue < ActiveRecord::Base
               estimated * ratio
             }.sum
             progress = done / (average * children.count)
-            p.done_ratio = progress.round
+            p.done_ratio = progress.floor
           end
         end
       end
index a50df024c770f02233e5026ab4560b63cd850632..00d64a05289b4c60c8b78932f0ee40673e8b2ca2 100644 (file)
@@ -157,6 +157,17 @@ class IssueSubtaskingTest < ActiveSupport::TestCase
     end
   end
 
+  def test_parent_done_ratio_should_be_rounded_down_to_the_nearest_integer
+    with_settings :parent_issue_done_ratio => 'derived' do
+      parent = Issue.generate!
+      parent.generate_child!(:done_ratio => 20)
+      parent.generate_child!(:done_ratio => 20)
+      parent.generate_child!(:done_ratio => 10)
+      # (20 + 20 + 10) / 3 = 16.666...
+      assert_equal 16, parent.reload.done_ratio
+    end
+  end
+
   def test_parent_done_ratio_should_be_weighted_by_estimated_times_if_any
     with_settings :parent_issue_done_ratio => 'derived' do
       parent = Issue.generate!