Skip to content
代码片段 群组 项目
未验证 提交 2d944f23 编辑于 作者: Nicolas Dular's avatar Nicolas Dular 提交者: GitLab
浏览文件

Compare more date data for epic syncing

上级 8826b072
No related branches found
No related tags found
无相关合并请求
...@@ -43,10 +43,7 @@ def attributes ...@@ -43,10 +43,7 @@ def attributes
check_parent check_parent
check_child_issues check_child_issues
check_relative_position check_relative_position
check_start_date_is_fixed check_dates
check_start_date_fixed
check_due_date_is_fixed
check_due_date_fixed
check_related_epic_links check_related_epic_links
mismatched_attributes mismatched_attributes
...@@ -109,32 +106,63 @@ def check_relative_position ...@@ -109,32 +106,63 @@ def check_relative_position
mismatched_attributes.push("relative_position") mismatched_attributes.push("relative_position")
end end
def check_start_date_is_fixed def check_dates
return if epic.start_date_is_fixed == work_item.dates_source&.start_date_is_fixed work_item_dates_source = work_item.dates_source
return if epic.start_date_is_fixed.nil? && work_item.dates_source.start_date_is_fixed == false
check_start_date_is_fixed(work_item_dates_source)
check_start_date_fixed(work_item_dates_source)
check_due_date_is_fixed(work_item_dates_source)
check_due_date_fixed(work_item_dates_source)
check_source_milestone(work_item_dates_source)
check_source_epic(work_item_dates_source)
end
def check_start_date_is_fixed(dates_source)
return if epic.start_date_is_fixed == dates_source&.start_date_is_fixed
return if epic.start_date_is_fixed.nil? && dates_source.start_date_is_fixed == false
mismatched_attributes.push("start_date_is_fixed") mismatched_attributes.push("start_date_is_fixed")
end end
def check_start_date_fixed def check_start_date_fixed(dates_source)
return if epic.start_date_fixed == work_item.dates_source&.start_date_fixed return if epic.start_date_fixed == dates_source&.start_date_fixed
mismatched_attributes.push("start_date_fixed") mismatched_attributes.push("start_date_fixed")
end end
def check_due_date_is_fixed def check_due_date_is_fixed(dates_source)
return if epic.due_date_is_fixed == work_item.dates_source&.due_date_is_fixed return if epic.due_date_is_fixed == dates_source&.due_date_is_fixed
return if epic.due_date_is_fixed.nil? && work_item.dates_source.due_date_is_fixed == false return if epic.due_date_is_fixed.nil? && dates_source.due_date_is_fixed == false
mismatched_attributes.push("due_date_is_fixed") mismatched_attributes.push("due_date_is_fixed")
end end
def check_due_date_fixed def check_due_date_fixed(dates_source)
return if epic.due_date_fixed == work_item.dates_source&.due_date_fixed return if epic.due_date_fixed == dates_source&.due_date_fixed
mismatched_attributes.push("due_date_fixed") mismatched_attributes.push("due_date_fixed")
end end
def check_source_milestone(dates_source)
if epic.start_date_sourcing_milestone_id != dates_source&.start_date_sourcing_milestone_id
mismatched_attributes.push("start_date_sourcing_milestone")
end
return if epic.due_date_sourcing_milestone_id == dates_source&.due_date_sourcing_milestone_id
mismatched_attributes.push("due_date_sourcing_milestone")
end
def check_source_epic(dates_source)
if epic.start_date_sourcing_epic&.issue_id != dates_source&.start_date_sourcing_work_item_id
mismatched_attributes.push("start_date_sourcing_epic")
end
return if epic.due_date_sourcing_epic&.issue_id == dates_source&.due_date_sourcing_work_item_id
mismatched_attributes.push("due_date_sourcing_epic")
end
def check_related_epic_links def check_related_epic_links
related_epic_issues = epic.unauthorized_related_epics related_epic_issues = epic.unauthorized_related_epics
......
...@@ -148,12 +148,19 @@ ...@@ -148,12 +148,19 @@
end end
end end
describe 'start dates' do describe 'dates' do
let_it_be(:expected_start_date) { Time.current.to_date } let_it_be(:expected_start_date) { Time.current.to_date }
let_it_be(:expected_due_date) { expected_start_date + 2.days } let_it_be(:expected_due_date) { expected_start_date + 2.days }
let_it_be(:milestone) { create(:milestone) }
let_it_be(:start_date_sourcing_epic) { create(:epic) }
let_it_be(:due_date_sourcing_epic) { create(:epic) }
let_it_be_with_reload(:epic) do let_it_be_with_reload(:epic) do
create(:epic, :with_synced_work_item, group: group, start_date_fixed: expected_start_date, create(:epic, :with_synced_work_item, group: group, start_date_fixed: expected_start_date,
due_date_fixed: expected_due_date, start_date_is_fixed: true, due_date_is_fixed: true due_date_fixed: expected_due_date, start_date_is_fixed: true, due_date_is_fixed: true,
start_date_sourcing_milestone_id: milestone.id, due_date_sourcing_milestone_id: milestone.id,
start_date_sourcing_epic: start_date_sourcing_epic,
due_date_sourcing_epic: due_date_sourcing_epic
) )
end end
...@@ -164,14 +171,25 @@ ...@@ -164,14 +171,25 @@
:fixed, :fixed,
work_item: work_item, work_item: work_item,
start_date: expected_start_date, start_date: expected_start_date,
due_date: expected_due_date) due_date: expected_due_date,
start_date_sourcing_milestone_id: milestone.id,
due_date_sourcing_milestone_id: milestone.id,
start_date_sourcing_work_item_id: start_date_sourcing_epic.issue_id,
due_date_sourcing_work_item_id: due_date_sourcing_epic.issue_id
)
end end
it { is_expected.to be_empty } it { is_expected.to be_empty }
end end
context 'when it is different' do context 'when it is different' do
it { is_expected.to include("start_date_fixed", "due_date_fixed", "start_date_is_fixed", "due_date_is_fixed") } it do
is_expected.to include(
"start_date_fixed", "due_date_fixed", "start_date_is_fixed", "due_date_is_fixed",
"start_date_sourcing_milestone", "due_date_sourcing_milestone",
"start_date_sourcing_epic", "due_date_sourcing_epic"
)
end
end end
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册