Skip to content

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

Restore functionality of bulk edit done_ratio

Oliver Günther0dae9a7c9a49
diff --git a/app/views/work_packages/bulk/edit.html.erb b/app/views/work_packages/bulk/edit.html.erb
index 69dd60bc6ba..05b8f37f712 100644
--- a/app/views/work_packages/bulk/edit.html.erb
+++ b/app/views/work_packages/bulk/edit.html.erb
@@ -204,6 +204,14 @@ See COPYRIGHT and LICENSE files for more details.
} %>
</div>
</div>
+ <% if WorkPackage.work_based_mode? %>
+ <div class="form--field">
+ <%= styled_label_tag :work_package_done_ratio, WorkPackage.human_attribute_name(:done_ratio) %>
+ <div class="form--field-container">
+ <%= styled_text_field_tag "work_package[done_ratio]", "", type: :number, size: 10 %>
+ </div>
+ </div>
+ <% end %>
</div>
</div>
</fieldset>
diff --git a/spec/controllers/work_packages/bulk_controller_spec.rb b/spec/controllers/work_packages/bulk_controller_spec.rb
index 585e9bb26fd..1a9f5e4c896 100644
--- a/spec/controllers/work_packages/bulk_controller_spec.rb
+++ b/spec/controllers/work_packages/bulk_controller_spec.rb
@@ -534,6 +534,38 @@ RSpec.describe WorkPackages::BulkController, with_settings: { journal_aggregatio
end
end
end
+
+ describe "#done_ratio" do
+ before do
+ put :update,
+ params: {
+ ids: work_package_ids,
+ work_package: { done_ratio: }
+ }
+ end
+
+ context "with a valid done_ratio" do
+ let(:done_ratio) { 55 }
+
+ subject { work_packages.map(&:done_ratio).uniq }
+
+ it { is_expected.to contain_exactly(55) }
+ end
+
+ context "with an invalid done_ratio" do
+ let(:done_ratio) { 150 }
+
+ subject { work_packages.map(&:done_ratio).uniq }
+
+ it "does not succeed" do
+ expect(flash[:error])
+ .to include(I18n.t(:"work_packages.bulk.none_could_be_saved",
+ total: 2))
+
+ expect(subject).to contain_exactly(nil)
+ end
+ end
+ end
end
end