Skip to content

Commit 469b95f

Browse files
make sure there are no previous phases if the timeline template has changed
1 parent 1d67c57 commit 469b95f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/services/ChallengeService.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,9 @@ async function update (currentUser, challengeId, data, isFull) {
14141414
if (finalStatus !== constants.challengeStatuses.New && finalTimelineTemplateId !== challenge.timelineTemplateId) {
14151415
throw new errors.BadRequestError(`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`)
14161416
}
1417+
} else {
1418+
// make sure there are no previous phases if the timeline template has changed
1419+
challenge.phases = []
14171420
}
14181421

14191422
if (data.prizeSets) {

0 commit comments

Comments
 (0)