OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Merge branch 'release/14.0' into bug/54179-update-total-remaining-work-of-parent-when-children-are-closed
Christophe Bliardfdf681285cb2
diff --cc lib/open_project/text_formatting/filters/link_attribute_filter.rbindex 451a51446ae,c2b313e86ae..e8e9a5a2139--- a/lib/open_project/text_formatting/filters/link_attribute_filter.rb+++ b/lib/open_project/text_formatting/filters/link_attribute_filter.rb@@@ -38,7 -40,7 +40,7 @@@ module OpenProject::TextFormattinenddef links- doc.css('a[href^="/"]')- doc.css('a')++ doc.css("a")endendenddiff --cc spec/migrations/update_progress_calculation_spec.rbindex 799241e1840,bfded12c7f5..8ce33af5d5b--- a/spec/migrations/update_progress_calculation_spec.rb+++ b/spec/migrations/update_progress_calculation_spec.rb@@@ -710,86 -698,66 +718,147 @@@ RSpec.describe UpdateProgressCalculatioendend+ context "when parent does not have any work or remaining work set, " \+ "and children have a 100% complete status" do+ it "sets parent total % complete to 100%" do+ expect_migrates(+ from: <<~TABLE,+ hierarchy | work | remaining work | % complete+ parent | | |+ child1 | 10h | 0h | 100%+ child2 | 10h | 0h | 100%+ TABLE+ to: <<~TABLE+ hierarchy | work | remaining work | % complete | ∑ work | ∑ remaining work | ∑ % complete+ parent | | | | 20h | 0h | 100%+ child1 | 10h | 0h | 100% | 10h | 0h | 100%+ child2 | 10h | 0h | 100% | 10h | 0h | 100%+ TABLE+ )+ end+ end++ context "when work and remaining work are unset" do+ it "does not set total work, total remaining work, and total % complete" do+ expect_migrates(+ from: <<~TABLE,+ subject | work | remaining work | % complete+ wp all unset | | |+ wp 0% | | | 0%+ wp 30% | | | 30%+ wp 100% | | | 100%+ TABLE+ to: <<~TABLE+ subject | work | remaining work | % complete | ∑ work | ∑ remaining work | ∑ % complete+ wp all unset | | | | | |+ wp 0% | | | 0% | | |+ wp 30% | | | 30% | | |+ wp 100% | | | 100% | | |+ TABLE+ )+ end+ end++ context "when work is set to 0h and remaining work is unset" do+ it "sets remaining work, total work, and total remaining work to 0h, unsets % complete, and keeps total % complete unset" do+ expect_migrates(+ from: <<~TABLE,+ subject | work | remaining work | % complete+ wp all unset | 0h | |+ wp 0% | 0h | | 0%+ wp 30% | 0h | | 30%+ wp 100% | 0h | | 100%+ TABLE+ to: <<~TABLE+ subject | work | remaining work | % complete | ∑ work | ∑ remaining work | ∑ % complete+ wp all unset | 0h | 0h | | 0h | 0h |+ wp 0% | 0h | 0h | | 0h | 0h |+ wp 30% | 0h | 0h | | 0h | 0h |+ wp 100% | 0h | 0h | | 0h | 0h |+ TABLE+ )+ end+ end++ context "when work and remaining work are set and not 0h" do+ it "sets total work, total remaining work, and total % complete accordingly same as work, remaining work and % complete" do+ expect_migrates(+ from: <<~TABLE,+ subject | work | remaining work |+ wp w set | 10h | |+ wp rw set | | 5h |+ wp w rw set | 10h | 5h |+ TABLE+ to: <<~TABLE+ subject | work | remaining work | % complete | ∑ work | ∑ remaining work | ∑ % complete+ wp w set | 10h | 10h | 0% | 10h | 10h | 0%+ wp rw set | 5h | 5h | 0% | 5h | 5h | 0%+ wp w rw set | 10h | 5h | 50% | 10h | 5h | 50%+ TABLE+ )+ end+ end+++ context "when ∑ % complete has had some values (including wrong ones)" do+ let_work_packages(<<~TABLE)+ hierarchy | work | remaining work | % complete | ∑ work | ∑ remaining work | ∑ % complete |+ wp zero | | | 0 | | | 0 |+ wp correct | 100h | 50h | 50 | 100h | 50h | 50 |+ wp wrong | | | 90 | 100h | 50h | 90 |+ wp wrong child | 100h | 50h | 20 | 10h | 10h | 20 |+ TABLE++ before do+ run_migration+ end++ it "fixes the total values and sets ∑ % complete to nil (not 0) but keeps % complete (unless wrong)" do+ expect_work_packages(WorkPackage.all, <<~TABLE)+ subject | work | remaining work | % complete | ∑ work | ∑ remaining work | ∑ % complete |+ wp zero | | | 0 | | | |+ wp correct | 100h | 50h | 50 | 100h | 50h | 50 |+ wp wrong | | | 90 | 100h | 50h | 50 |+ wp wrong child | 100h | 50h | 50 | 100h | 50h | 50 |+ TABLE+ end++ it "creates no journal for the work package transitioning from 0 to nil and reworks the pre migration journals" do+ expect(wp_zero.journals.count).to eq(1)++ expect(wp_zero.journals.first.get_changes.keys)+ .not_to include("derived_done_ratio")+ end++ it "creates a journal for the correct work package as the old ∑ % complete value has been set to null during the job" do+ expect(wp_correct.journals.count).to eq(2)++ expect(wp_correct.journals.first.get_changes.keys)+ .not_to include("derived_done_ratio")++ expect(wp_correct.journals.last.get_changes["derived_done_ratio"])+ .to eql [nil, 50]+ end++ it "creates a journal for the work package transitioning from 90 to 50 and reworks the pre migration journals" do+ expect(wp_wrong.journals.count).to eq(2)++ expect(wp_wrong.journals.first.get_changes.keys)+ .not_to include("derived_done_ratio")++ expect(wp_wrong.journals.last.get_changes["derived_done_ratio"])+ .to eql [nil, 50]+ end++ it "creates a journal for the work package transitioning from 20 to 50 and reworks the pre migration journals" do+ expect(wp_wrong_child.journals.count).to eq(2)++ expect(wp_wrong_child.journals.first.get_changes.keys)+ .not_to include("derived_done_ratio")++ expect(wp_wrong_child.journals.last.get_changes["derived_done_ratio"])+ .to eql [nil, 50]+ end+ endenddescribe "error during job execution" do