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
[50958] Stop copying estimated_hours to remaining_hours and vice versa
Christophe Bliard34bc77468324
diff --git a/modules/backlogs/lib/open_project/backlogs/patches/work_package_patch.rb b/modules/backlogs/lib/open_project/backlogs/patches/work_package_patch.rbindex 77e28aaa470..a1d5c29ad13 100644--- a/modules/backlogs/lib/open_project/backlogs/patches/work_package_patch.rb+++ b/modules/backlogs/lib/open_project/backlogs/patches/work_package_patch.rb@@ -33,8 +33,6 @@ module OpenProject::Backlogs::Patches::WorkPackagePatchprepend InstanceMethodsextend ClassMethods- before_validation :backlogs_before_validation, if: -> { backlogs_enabled? }-register_journal_formatted_fields(:fraction, 'remaining_hours')register_journal_formatted_fields(:fraction, 'derived_remaining_hours')register_journal_formatted_fields(:decimal, 'story_points')@@ -130,15 +128,6 @@ module OpenProject::Backlogs::Patches::WorkPackagePatchdef in_backlogs_type?backlogs_enabled? && WorkPackage.backlogs_types.include?(type.try(:id))end-- private-- def backlogs_before_validation- if type_id == Task.type- self.estimated_hours = remaining_hours if estimated_hours.blank? && remaining_hours.present?- self.remaining_hours = estimated_hours if remaining_hours.blank? && estimated_hours.present?- end- endendenddiff --git a/modules/backlogs/spec/models/task_spec.rb b/modules/backlogs/spec/models/task_spec.rbindex b0316f5175c..38b6b77a373 100644--- a/modules/backlogs/spec/models/task_spec.rb+++ b/modules/backlogs/spec/models/task_spec.rb@@ -101,49 +101,4 @@ RSpec.describe Task doendendend-- describe 'copying remaining_hours to estimated_hours and vice versa' do- context 'providing only remaining_hours' do- before do- task.remaining_hours = 3-- task.save!- end-- it 'copies to estimated_hours' do- expect(task.estimated_hours)- .to eql task.remaining_hours- end- end-- context 'providing only estimated_hours' do- before do- task.estimated_hours = 3-- task.save!- end-- it 'copies to estimated_hours' do- expect(task.remaining_hours)- .to eql task.estimated_hours- end- end-- context 'providing estimated_hours and remaining_hours' do- before do- task.estimated_hours = 3- task.remaining_hours = 5-- task.save!- end-- it 'leaves the values unchanged' do- expect(task.remaining_hours)- .to be 5.0-- expect(task.estimated_hours)- .to be 3.0- end- end- endend