Skip to content

Commit 8d32683

Browse files
Merge pull request #382 from topcoder-platform/develop
handle missing predecessors
2 parents 00b883e + dba2f00 commit 8d32683

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/services/ChallengeService.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,10 +789,13 @@ async function populatePhases (phases, startDate, timelineTemplateId) {
789789
doing = true
790790
} else {
791791
const preIndex = _.findIndex(phases, (p) => p.id === phase.predecessor)
792+
let canProcess = true
792793
if (preIndex < 0) {
793-
throw new Error(`Invalid phase predecessor: ${phase.predecessor}`)
794+
canProcess = false
795+
delete phase.predecessor
796+
i -= 1
794797
}
795-
if (done[preIndex]) {
798+
if (canProcess && done[preIndex]) {
796799
phase.scheduledStartDate = phases[preIndex].scheduledEndDate
797800
phase.scheduledEndDate = moment(phase.scheduledStartDate).add(phase.duration || 0, 'seconds').toDate()
798801
phase.actualStartDate = phase.scheduledStartDate

0 commit comments

Comments
 (0)