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

Change default for ignore_non_working_days on work packages

Dombi Attilaa519ba0c72f9
diff --git a/db/migrate/20220830092057_change_default_for_non_working_days.rb b/db/migrate/20220830092057_change_default_for_non_working_days.rb
new file mode 100644
index 00000000000..2a348b32abb
--- /dev/null
+++ b/db/migrate/20220830092057_change_default_for_non_working_days.rb
@@ -0,0 +1,13 @@
+class ChangeDefaultForNonWorkingDays < ActiveRecord::Migration[7.0]
+ def change
+ change_column_default :work_packages, :ignore_non_working_days, from: true, to: false
+
+ reversible do |dir|
+ dir.up do
+ execute <<~SQL.squish
+ UPDATE work_packages SET ignore_non_working_days = TRUE
+ SQL
+ end
+ end
+ end
+end
diff --git a/spec/contracts/work_packages/base_contract_spec.rb b/spec/contracts/work_packages/base_contract_spec.rb
index e2a1f1ad1fa..6167ca731b9 100644
--- a/spec/contracts/work_packages/base_contract_spec.rb
+++ b/spec/contracts/work_packages/base_contract_spec.rb
@@ -694,10 +694,10 @@ describe WorkPackages::BaseContract do
it_behaves_like 'contract is valid'
end
- context 'when setting the value to false and with the feature disabled',
+ context 'when setting the value to true and with the feature disabled',
with_flag: { work_packages_duration_field_active: false } do
before do
- work_package.ignore_non_working_days = false
+ work_package.ignore_non_working_days = true
end
it_behaves_like 'contract is invalid', ignore_non_working_days: :error_readonly
diff --git a/spec/models/work_package_spec.rb b/spec/models/work_package_spec.rb
index 84d2d42dc3c..a5872d36816 100644
--- a/spec/models/work_package_spec.rb
+++ b/spec/models/work_package_spec.rb
@@ -699,7 +699,7 @@ describe WorkPackage, type: :model do
context 'for a new record' do
it 'is true' do
expect(described_class.new.ignore_non_working_days)
- .to be true
+ .to be false
end
end
end