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

Fix external dropping by setting an ID

Oliver Güntherc7d92e3500b9
diff --git a/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts b/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts
index 6a1db54d88c..98ede1dd67e 100644
--- a/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts
+++ b/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts
@@ -115,6 +115,7 @@ export class CalendarDragDropService {
const diff = dueDate.diff(startDate, 'days') + 1;
return {
+ id: `${workPackage.href as string}-external`,
title: workPackage.subject,
duration: {
days: diff || 1,
diff --git a/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rb b/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rb
index abe5903a166..03820e9ccae 100644
--- a/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rb
@@ -36,6 +36,7 @@ describe 'Team planner add existing work packages', type: :feature, js: true do
include_context 'with team planner full access'
let(:closed_status) { create :status, is_closed: true }
+ let(:start_of_week) { Time.zone.today.beginning_of_week(:sunday) }
let!(:other_user) do
create :user,
@@ -51,8 +52,8 @@ describe 'Team planner add existing work packages', type: :feature, js: true do
project: project,
subject: 'Task 1',
assigned_to: user,
- start_date: Time.zone.today.beginning_of_week.next_occurring(:tuesday),
- due_date: Time.zone.today.beginning_of_week.next_occurring(:thursday)
+ start_date: start_of_week.next_occurring(:tuesday),
+ due_date: start_of_week.next_occurring(:thursday)
end
let!(:second_wp) do
create :work_package,
@@ -107,8 +108,8 @@ describe 'Team planner add existing work packages', type: :feature, js: true do
# ... and thus update its attributes. Thereby the duration is maintained
second_wp.reload
- expect(second_wp.start_date).to eq(Time.zone.today.beginning_of_week.next_occurring(:tuesday))
- expect(second_wp.due_date).to eq(Time.zone.today.beginning_of_week.next_occurring(:thursday))
+ expect(second_wp.start_date).to eq(start_of_week.next_occurring(:tuesday))
+ expect(second_wp.due_date).to eq(start_of_week.next_occurring(:thursday))
expect(second_wp.assigned_to_id).to eq(user.id)
# Search for another work package
@@ -124,8 +125,8 @@ describe 'Team planner add existing work packages', type: :feature, js: true do
# ... and thus update its attributes. Since no dates were set before, start and end date are set to the same day
third_wp.reload
- expect(third_wp.start_date).to eq(Time.zone.today.beginning_of_week.next_occurring(:tuesday))
- expect(third_wp.due_date).to eq(Time.zone.today.beginning_of_week.next_occurring(:tuesday))
+ expect(third_wp.start_date).to eq(start_of_week.next_occurring(:tuesday))
+ expect(third_wp.due_date).to eq(start_of_week.next_occurring(:tuesday))
expect(third_wp.assigned_to_id).to eq(user.id)
# New events are directly clickable