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
Preserve the field value of only one field was touched anyway
Henriette Darge62aae22f5a59
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.tsindex 6be97e64c8f..95398ea1f37 100644--- a/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.ts@@ -499,10 +499,12 @@ export default class PreviewController extends DialogPreviewController {}private untouchFieldsWhenDurationIsEdited():void {- if (this.isValueSet('start_date')) {- this.markUntouched('due_date');- } else if (this.isValueSet('due_date')) {- this.markUntouched('start_date');+ if (this.areBothTouched('start_date', 'due_date')) {+ if (this.isValueSet('start_date')) {+ this.markUntouched('due_date');+ } else if (this.isValueSet('due_date')) {+ this.markUntouched('start_date');+ }}}}diff --git a/spec/features/work_packages/datepicker/datepicker_single_date_mode_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_single_date_mode_logic_spec.rbindex e9ba036dbce..d52ee2a254c 100644--- a/spec/features/work_packages/datepicker/datepicker_single_date_mode_logic_spec.rb+++ b/spec/features/work_packages/datepicker/datepicker_single_date_mode_logic_spec.rb@@ -374,6 +374,32 @@ RSpec.describe "Datepicker: Single-date mode logic test cases (WP #61146)", :js,endend+ context "when a finish date is given, then changed and a duration is added (scenario 9b)" do+ let(:current_attributes) do+ {+ start_date: nil,+ due_date: "2025-02-14",+ duration: nil+ }+ end++ it "switches to range mode and calculates a start date" do+ datepicker.expect_start_date "", visible: false+ datepicker.expect_due_date "2025-02-14"+ datepicker.expect_duration ""++ datepicker.set_due_date "2025-02-13"+ datepicker.focus_duration+ datepicker.set_duration 3++ datepicker.expect_start_date "2025-02-11"+ datepicker.expect_due_date "2025-02-13"+ datepicker.expect_duration "3"++ datepicker.expect_duration_highlighted+ end+ end+context "when a start date is given and a finish date is added (scenario 10)" dolet(:current_attributes) do{@@ -452,6 +478,32 @@ RSpec.describe "Datepicker: Single-date mode logic test cases (WP #61146)", :js,endend+ context "when a start date is given, then changed and a duration is added (scenario 12b)" do+ let(:current_attributes) do+ {+ start_date: "2025-02-12",+ due_date: nil,+ duration: nil+ }+ end++ it "switches to range mode and calculates a finish date" do+ datepicker.expect_start_date "2025-02-12"+ datepicker.expect_due_date "", visible: false+ datepicker.expect_duration ""++ datepicker.set_start_date "2025-02-11"+ datepicker.focus_duration+ datepicker.set_duration 3++ datepicker.expect_start_date "2025-02-11"+ datepicker.expect_due_date "2025-02-13"+ datepicker.expect_duration "3"++ datepicker.expect_duration_highlighted+ end+ end+context "when start and finish date are given and the finish date is removed (scenario 13)" dolet(:current_attributes) do{