Skip to content

Commit

Permalink
fix: don't create wrong phases in new challenges
Browse files Browse the repository at this point in the history
API creates them automatically by "timelineTemplateId"
  • Loading branch information
maxceem committed Dec 21, 2020
1 parent d2f1512 commit 6a1758e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,7 @@ class ChallengeEditor extends Component {
},
descriptionFormat: 'markdown',
timelineTemplateId: defaultTemplate.id,
terms: [{ id: DEFAULT_TERM_UUID, roleId: SUBMITTER_ROLE_UUID }],
phases: this.getTemplatePhases(defaultTemplate)
terms: [{ id: DEFAULT_TERM_UUID, roleId: SUBMITTER_ROLE_UUID }]
// prizeSets: this.getDefaultPrizeSets()
}
const discussions = this.getDiscussionsConfig(newChallenge)
Expand Down Expand Up @@ -841,6 +840,14 @@ class ChallengeEditor extends Component {
}
}

/*
TODO
IMPORTANT!!!
This method might be wrong. We might need to fix it when enabling editing phases UI.
See issue which caused by using of this method https://github.com/topcoder-platform/work-manager/issues/1012
*/
getTemplatePhases (template) {
const timelinePhaseIds = template.phases.map(timelinePhase => timelinePhase.phaseId || timelinePhase)
const validPhases = _.cloneDeep(this.props.metadata.challengePhases).filter(challengePhase => {
Expand Down

0 comments on commit 6a1758e

Please sign in to comment.