Skip to content

Commit 2e41c9e

Browse files
committed
Fixed bug while activating phase.
1 parent a154e04 commit 2e41c9e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/projects/actions/project.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
374374
const phaseStatusChanged = phase.status !== updatedProps.status
375375
const productId = phase.products[0].id
376376
const timeline = state.productsTimelines[productId] && state.productsTimelines[productId].timeline
377+
const startDateChanged =updatedProps.startDate && updatedProps.startDate.diff(timeline.startDate)
378+
const phaseActivated = phaseStatusChanged && updatedProps.status === PHASE_STATUS_ACTIVE
377379

378380
return dispatch({
379381
type: UPDATE_PHASE,
@@ -397,7 +399,7 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
397399
// - phase's status is changed to active
398400
// - there is not active milestone alreay (this can happen when phase is made active more than once
399401
// e.g. Active => Paused => Active)
400-
if (timeline && phaseStatusChanged && !activeMilestone && updatedProps.status === PHASE_STATUS_ACTIVE ) {
402+
if (timeline && !activeMilestone && phaseActivated ) {
401403
dispatch(
402404
updateProductMilestone(
403405
productId,
@@ -409,7 +411,7 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
409411
}
410412
}
411413

412-
if (timeline && updatedProps.startDate && updatedProps.startDate.diff(timeline.startDate)) {
414+
if (timeline && (startDateChanged || phaseActivated)) {
413415
dispatch(
414416
updateProductTimeline(
415417
productId,

0 commit comments

Comments
 (0)