Skip to content

Commit 1573206

Browse files
author
vikasrohit
authored
Merge pull request #2388 from appirio-tech/dev
Some quick fixes identified as issues while testing on dev
2 parents 2c99225 + 6b0a833 commit 1573206

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/helpers/projectHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function formatProjectProgressProps(project, phases, productsTimelines) {
111111

112112
// calculate progress of phase
113113
const timeline = productsTimelines[phase.products[0].id].timeline
114-
if (timeline && timeline.milestones.length > 0) {
114+
if (timeline && timeline.milestones && timeline.milestones.length > 0) {
115115
const timelineNow = moment().utc()
116116
let tlPlannedDuration = 0
117117
let tlCurrentDuration = 0
@@ -239,7 +239,7 @@ export function getPhaseActualData(phase, timeline) {
239239
let progress
240240

241241
// if phase's product doesn't have timeline get data from phase
242-
if (!timeline || timeline.milestones.length < 1) {
242+
if (!timeline || !timeline.milestones || timeline.milestones.length < 1) {
243243
startDate = phase.startDate && moment.utc(phase.startDate)
244244
endDate = phase.endDate && moment.utc(phase.endDate)
245245
duration = phase.duration ? phase.duration : 0

src/projects/actions/project.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
376376
const timeline = state.productsTimelines[productId] && state.productsTimelines[productId].timeline
377377
const startDateChanged =updatedProps.startDate && updatedProps.startDate.diff(timeline.startDate)
378378
const phaseActivated = phaseStatusChanged && updatedProps.status === PHASE_STATUS_ACTIVE
379+
if (phaseActivated) {
380+
updatedProps.startDate = moment().hours(0).minutes(0).seconds(0).milliseconds(0)
381+
}
379382

380383
return dispatch({
381384
type: UPDATE_PHASE,

0 commit comments

Comments
 (0)