Skip to content
Snippets Groups Projects
Commit 0c28af3f authored by Alexandru Croitor's avatar Alexandru Croitor
Browse files

Fix iteration state when building iterations in advance

When building iterations in advance for a given cadence we do
create iterations using bulk insert, so we do skip some callbacks
because of that we need to compute the iteration state before
inserting.
parent b80f5dd8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -66,6 +66,7 @@ def build_iteration(cadence, next_start_date, iteration_number, iid)
group_id: cadence.group_id,
start_date: start_date,
due_date: due_date,
state_enum: Iteration::STATE_ENUM_MAP[::Iteration.compute_state(start_date, due_date)],
title: title,
description: description
}
Loading
Loading
Loading
Loading
@@ -173,6 +173,12 @@
"Iteration 5: #{(initial_due_date + 1.week + 1.day).strftime(Date::DATE_FORMATS[:long])} - #{(initial_due_date + 2.weeks).strftime(Date::DATE_FORMATS[:long])}"
])
end
it 'sets the states correctly based on iterations dates' do
subject
expect(group.reload.iterations.order(:start_date).map(&:state)).to eq(%w[closed closed current upcoming upcoming])
end
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment