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
Reset duration and unify dates if default type is milestone
Oliver Güntherc172397fa78b
diff --git a/app/services/work_packages/set_attributes_service.rb b/app/services/work_packages/set_attributes_service.rbindex aff89c852f0..aef4758227b 100644--- a/app/services/work_packages/set_attributes_service.rb+++ b/app/services/work_packages/set_attributes_service.rb@@ -313,6 +313,8 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributesreturn if available_types.include?(work_package.type) && work_package.typework_package.type = available_types.first+ update_duration+ unify_milestone_datesreassign_status assignable_statusesenddiff --git a/spec/services/work_packages/create_service_integration_spec.rb b/spec/services/work_packages/create_service_integration_spec.rbindex 0ae7bdf1172..489d6ca2aa8 100644--- a/spec/services/work_packages/create_service_integration_spec.rb+++ b/spec/services/work_packages/create_service_integration_spec.rb@@ -80,6 +80,43 @@ RSpec.describe WorkPackages::CreateService, 'integration', type: :model dologin_as(user)end+ context 'when the only type of the project is a milestone' do+ let(:default_type) do+ create(:type_milestone)+ end+ let(:project) { create(:project, types: [default_type]) }+++ describe 'call without date attributes' do+ let(:attributes) do+ { subject: 'blubs', project: }+ end++ it 'creates the default type without errors' do+ expect(service_result).to be_success+ expect(service_result.errors).to be_empty+ end+ end++ describe 'call with a parent non-milestone with dates' do+ let(:parent) do+ create(:work_package,+ project:,+ start_date: '2024-01-01',+ due_date: '2024-01-10',+ type: create(:type))+ end+ let(:attributes) do+ { subject: 'blubs', project:, parent: }+ end++ it 'creates the default type without errors' do+ expect(service_result).to be_success+ expect(service_result.errors).to be_empty+ end+ end+ end+describe '#call' dolet(:attributes) do{ subject: 'blubs',