From 2fb5e294d65697f3365a8d561a6aecdb2a63381a Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Tue, 21 Jul 2020 11:33:25 +0530 Subject: [PATCH] fix: git#740 - Can not activate challenge just pass the legacy object as it is coming from the GET response, with updates (if any that user makes - I guess only reviewType is the only thing that can be changed) --- src/components/ChallengeEditor/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 42692e7b..f5738b16 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -598,11 +598,11 @@ class ChallengeEditor extends Component { 'terms', 'prizeSets' ], this.state.challenge) - challenge.legacy = { + challenge.legacy = _.assign(this.state.challenge.legacy, { reviewType: challenge.reviewType, track: challenge.track - } - challenge.timelineTemplateId = this.getCurrentTemplate().id + }) + challenge.timelineTemplateId = _.get(this.getCurrentTemplate(), 'id') challenge.projectId = this.props.projectId challenge.prizeSets = challenge.prizeSets.map(p => { const prizes = p.prizes.map(s => ({ ...s, value: convertDollarToInteger(s.value, '$') })) @@ -703,7 +703,7 @@ class ChallengeEditor extends Component { } } else { let patchObject = (changedField === 'reviewType') - ? { legacy: { reviewType: this.state.challenge[changedField] } } + ? { legacy: { reviewType: this.state.challenge[changedField] } } // NOTE it assumes challenge API PATCH respects the changes in legacy JSON : { [changedField]: this.state.challenge[changedField] } if (changedField === 'phases' || changedField === 'reset-phases') { const { currentTemplate } = this.state