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
No longer display migration warning when only % complete is set
Christophe Bliard0d79dba0945a
diff --git a/app/components/work_packages/progress/work_based/modal_body_component.html.erb b/app/components/work_packages/progress/work_based/modal_body_component.html.erbindex 93291f03f64..0e188b98423 100644--- a/app/components/work_packages/progress/work_based/modal_body_component.html.erb+++ b/app/components/work_packages/progress/work_based/modal_body_component.html.erb@@ -20,12 +20,6 @@touched_field_map:)) %><% end %>- <% if should_display_migration_warning? %>- <% modal_body.with_row(mt: 3) do |_migration_warning| %>- <%= render(Primer::Alpha::Banner.new) { t("work_package.progress.modal.migration_warning_text") } %>- <% end %>- <% end %>-<% modal_body.with_row(mt: 3) do |_tooltip| %><%= render(Primer::Beta::Text.new(font_weight: :semibold)) { t("work_package.progress.label_note") } %><%= render(Primer::Beta::Text.new) { t("work_package.progress.modal.work_based_help_text") } %>diff --git a/app/components/work_packages/progress/work_based/modal_body_component.rb b/app/components/work_packages/progress/work_based/modal_body_component.rbindex c6d6e9c6c55..588a04224df 100644--- a/app/components/work_packages/progress/work_based/modal_body_component.rb+++ b/app/components/work_packages/progress/work_based/modal_body_component.rb@@ -31,8 +31,7 @@module WorkPackagesmodule Progressmodule WorkBased- # rubocop:disable OpenProject/AddPreviewForViewComponent- class ModalBodyComponent < BaseModalComponent+ class ModalBodyComponent < BaseModalComponent # rubocop:disable OpenProject/AddPreviewForViewComponentdef initialize(work_package,focused_field: nil,touched_field_map: {})@@ -40,13 +39,7 @@ module WorkPackages@mode = :work_basedend-- def should_display_migration_warning?- work_package.done_ratio.present? && work_package.estimated_hours.nil? && work_package.remaining_hours.nil?- endend-- # rubocop:enable OpenProject/AddPreviewForViewComponentendendenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 5d7707535d0..db2f379f373 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -3648,7 +3648,6 @@ en:modal:work_based_help_text: "% Complete is automatically derived from Work and Remaining work."status_based_help_text: "% Complete is set by work package status."- migration_warning_text: "In work-based progress calculation mode, % Complete cannot be manually set and is tied to Work. The existing value has been kept but cannot be edited. Please input Work first."permissions:comment: "Comment"comment_description: "Can view and comment this work package."diff --git a/spec/components/work_packages/progress/work_based/modal_body_component_spec.rb b/spec/components/work_packages/progress/work_based/modal_body_component_spec.rbindex a91c18857a0..a304347e2c2 100644--- a/spec/components/work_packages/progress/work_based/modal_body_component_spec.rb+++ b/spec/components/work_packages/progress/work_based/modal_body_component_spec.rb@@ -67,38 +67,4 @@ RSpec.describe WorkPackages::Progress::WorkBased::ModalBodyComponent,endendend-- describe "#should_display_migration_warning?" do- subject(:component) { described_class.new(work_package) }-- context "when the work package has a percent complete value but no work or remaining work set" do- let(:work_package) do- create(:work_package) do |work_package|- work_package.estimated_hours = nil- work_package.remaining_hours = nil- work_package.done_ratio = 10- work_package.save!(validate: false)- end- end-- it "returns true" do- expect(component.should_display_migration_warning?).to be true- end- end-- context "when the work package has a percent complete value but and a work value but no remaining work set" do- let(:work_package) do- create(:work_package) do |work_package|- work_package.estimated_hours = 55- work_package.remaining_hours = nil- work_package.done_ratio = 10- work_package.save!(validate: false)- end- end-- it "returns false" do- expect(component.should_display_migration_warning?).to be false- end- end- endenddiff --git a/spec/features/work_packages/progress_modal_spec.rb b/spec/features/work_packages/progress_modal_spec.rbindex a9b7d2e35f4..568a2c17841 100644--- a/spec/features/work_packages/progress_modal_spec.rb+++ b/spec/features/work_packages/progress_modal_spec.rb@@ -454,37 +454,6 @@ RSpec.describe "Progress modal", :js, :with_cuprite doendend- describe "When % Complete is set + work and remaining work are unset coming from a migration" do- before_all do- work_package.reload-- work_package.estimated_hours = nil- work_package.remaining_hours = nil- work_package.done_ratio = 5.0- work_package.save!(validate: false)- end-- shared_examples_for "migration warning" do |should_render: false|- it "renders a banner with a warning message" do- work_package_table.visit_query(progress_query)- work_package_table.expect_work_package_listed(work_package)-- work_edit_field = ProgressEditField.new(work_package_row, :estimatedTime)- modal = work_edit_field.activate!-- modal.expect_migration_warning_banner(should_render:)- end- end-- context "on work based mode" do- include_examples "migration warning", should_render: true- end-- context "on status based mode", with_settings: { work_package_done_ratio: "status" } do- include_examples "migration warning", should_render: false- end- end-describe "Live-update edge cases" docontext "given work = 10h, remaining work = 4h, % complete = 60%" dobefore { update_work_package_with(work_package, estimated_hours: 10.0, remaining_hours: 4.0) }diff --git a/spec/support/edit_fields/progress_edit_field.rb b/spec/support/edit_fields/progress_edit_field.rbindex 781f3f9e619..0b5daaa30d6 100644--- a/spec/support/edit_fields/progress_edit_field.rb+++ b/spec/support/edit_fields/progress_edit_field.rb@@ -177,18 +177,6 @@ class ProgressEditField < EditFieldendend- def expect_migration_warning_banner(should_render: true)- within modal_element do- if should_render- expect(page)- .to have_text(I18n.t("work_package.progress.modal.migration_warning_text"))- else- expect(page)- .to have_no_text(I18n.t("work_package.progress.modal.migration_warning_text"))- end- end- end-privateattr_reader :field_name