]> source.dussan.org Git - redmine.git/commitdiff
Adds test for #24457.
authorMarius Balteanu <marius.balteanu@zitec.com>
Thu, 2 May 2024 21:15:43 +0000 (21:15 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Thu, 2 May 2024 21:15:43 +0000 (21:15 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22804 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/version_test.rb

index 4b20c05a0062550c78726455000cf5cde743c0ac..d3f1e5aa24bdbc6982d06c744040805b2eb29e33 100644 (file)
@@ -149,6 +149,20 @@ class VersionTest < ActiveSupport::TestCase
     assert_progress_equal 25.0/100.0*100, v.closed_percent
   end
 
+  def test_progress_should_be_weighted_by_estimated_times_if_any_with_grandchildren
+    project = Project.find(1)
+    v = Version.create!(:project => project, :name => 'Progress')
+    with_settings :parent_issue_done_ratio => 'derived' do
+      parent = Issue.generate!
+      parent.generate_child!(:estimated_hours => 2, :done_ratio => 0, :fixed_version => v)
+      child = parent.generate_child!( :fixed_version => v)
+      child.generate_child!(:estimated_hours => 2, :done_ratio => 50)
+      child.generate_child!(:estimated_hours => 2, :done_ratio => 50)
+
+      assert_progress_equal 200.0 / (3.0 * 2), v.completed_percent
+    end
+  end
+
   def test_should_sort_scheduled_then_unscheduled_versions
     Version.delete_all
     v4 = Version.create!(:project_id => 1, :name => 'v4')