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

Correctly show all WPs in the linked relation Gantt view and adjust some tests

Henriette Darge9dc606c5de5e
diff --git a/app/components/work_packages/date_picker/banner_component.rb b/app/components/work_packages/date_picker/banner_component.rb
index c093290ed15..1a9caf65907 100644
--- a/app/components/work_packages/date_picker/banner_component.rb
+++ b/app/components/work_packages/date_picker/banner_component.rb
@@ -131,11 +131,24 @@ module WorkPackages
end
def all_relational_wp_ids
- @work_package
- .relations
- .pluck(:from_id, :to_id)
- .flatten
- .uniq
+ relation_ids = [@work_package.id.to_s]
+ relation_ids.push(
+ @work_package
+ .relations
+ .pluck(:from_id, :to_id)
+ .flatten
+ .uniq
+ )
+
+ if @work_package.parent_id.present?
+ relation_ids.push(@work_package.ancestors.pluck(:id).map(&:to_s)).flatten!
+ end
+
+ if @work_package.children.present?
+ relation_ids.push(@work_package.children.pluck(:id).map(&:to_s)).flatten!
+ end
+
+ relation_ids
end
def test_selector
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e46a80aa5d6..e89a08b55ba 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -710,7 +710,7 @@ en:
manual_mobile: "Ignoring relations."
manual_gap_between_predecessors: "There is a gap between this and all predecessors."
manual_overlap_with_predecessors: "Overlaps with at least one predecessor."
- manual_with_children: "This has child work package but their start dates are ignored."
+ manual_with_children: "This has child work packages but their start dates are ignored."
title:
automatic_mobile: "Automatically scheduled."
automatic_with_children: "The dates are determined by child work packages."
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index d65712cca9a..ddf581181bd 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -113,7 +113,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
due_date: Date.parse("2016-01-25"))
end
- it "selecting a date before the current start date will move the finish date" do
+ it "selecting a date before the current start date will keep the finish date" do
start_date.activate!
start_date.expect_active!
@@ -122,12 +122,12 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
start_date.datepicker.select_day "1"
start_date.datepicker.expect_start_date "2016-01-01"
- start_date.datepicker.expect_due_date "2016-01-24"
- start_date.datepicker.expect_duration 24
+ start_date.datepicker.expect_due_date "2016-01-25"
+ start_date.datepicker.expect_duration 25
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text "2016-01-01 - 2016-01-24"
+ start_date.expect_state_text "2016-01-01 - 2016-01-25"
end
it "selecting a date in between changes the date that is currently in focus" do
@@ -416,7 +416,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
it "shows a banner that the relations are ignored" do
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. This has child work packages but their start dates are ignored.")
+ text: "Manually scheduled. Dates not affected by relations.\nThis has child work packages but their start dates are ignored.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
@@ -445,7 +445,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
start_date.toggle_scheduling_mode
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. This has child work packages but their start dates are ignored.")
+ text: "Manually scheduled. Dates not affected by relations.\nThis has child work packages but their start dates are ignored.")
new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
@@ -479,7 +479,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
datepicker.expect_ignore_non_working_days true
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. This has child work packages but their start dates are ignored.")
+ text: "Manually scheduled. Dates not affected by relations.\nThis has child work packages but their start dates are ignored.")
# Reset when disabled
start_date.toggle_scheduling_mode