Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/helpers/projectHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function formatProjectProgressProps(project, phases, productsTimelines) {

// calculate progress of phase
const timeline = productsTimelines[phase.products[0].id].timeline
if (timeline && timeline.milestones.length > 0) {
if (timeline && timeline.milestones && timeline.milestones.length > 0) {
const timelineNow = moment().utc()
let tlPlannedDuration = 0
let tlCurrentDuration = 0
Expand Down Expand Up @@ -239,7 +239,7 @@ export function getPhaseActualData(phase, timeline) {
let progress

// if phase's product doesn't have timeline get data from phase
if (!timeline || timeline.milestones.length < 1) {
if (!timeline || !timeline.milestones || timeline.milestones.length < 1) {
startDate = phase.startDate && moment.utc(phase.startDate)
endDate = phase.endDate && moment.utc(phase.endDate)
duration = phase.duration ? phase.duration : 0
Expand Down
3 changes: 3 additions & 0 deletions src/projects/actions/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
const timeline = state.productsTimelines[productId] && state.productsTimelines[productId].timeline
const startDateChanged =updatedProps.startDate && updatedProps.startDate.diff(timeline.startDate)
const phaseActivated = phaseStatusChanged && updatedProps.status === PHASE_STATUS_ACTIVE
if (phaseActivated) {
updatedProps.startDate = moment().hours(0).minutes(0).seconds(0).milliseconds(0)
}

return dispatch({
type: UPDATE_PHASE,
Expand Down