Skip to content

Commit 46e56d1

Browse files
committed
Fix up challenge status normalization to match v6 changes
1 parent d1abf94 commit 46e56d1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/actions/challenges.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ export function updateChallengeDetails (challengeId, challengeDetails, projectId
335335
if (hasMilestone) {
336336
delete challengeDetails.milestoneId
337337
}
338-
if (challengeDetails.status === 'Completed') {
339-
// Cannot update prizeSets for challenges with status: Completed!
338+
if (challengeDetails.status === CHALLENGE_STATUS.COMPLETED) {
339+
// Cannot update prizeSets for challenges with status: COMPLETED!
340340
delete challengeDetails.prizeSets
341341
}
342342
return updateChallenge(challengeId, challengeDetails).then(async challenge => {

src/components/ChallengesComponent/ChallengeCard/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class ChallengeCard extends React.Component {
177177
this.setState({ isSaving: true })
178178
const isTask = _.get(challenge, 'task.isTask', false)
179179
const payload = {
180-
status: 'Active'
180+
status: CHALLENGE_STATUS.ACTIVE
181181
}
182182
if (isTask) {
183183
payload.startDate = moment().format()

src/containers/ChallengeEditor/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { loadSubmissions } from '../../actions/challengeSubmissions'
3838
import { loadProject } from '../../actions/projects'
3939

4040
import { connect } from 'react-redux'
41-
import { SUBMITTER_ROLE_UUID, MESSAGE, PROJECT_ROLES } from '../../config/constants'
41+
import { SUBMITTER_ROLE_UUID, MESSAGE, PROJECT_ROLES, CHALLENGE_STATUS } from '../../config/constants'
4242
import { patchChallenge } from '../../services/challenges'
4343
import ConfirmationModal from '../../components/Modal/ConfirmationModal'
4444
import AlertModal from '../../components/Modal/AlertModal'
@@ -276,7 +276,7 @@ class ChallengeEditor extends Component {
276276
try {
277277
this.setState({ isLaunching: true })
278278
const payload = {
279-
status: 'Active'
279+
status: CHALLENGE_STATUS.ACTIVE
280280
}
281281
if (isTask) {
282282
payload.startDate = moment().format()
@@ -332,7 +332,7 @@ class ChallengeEditor extends Component {
332332
this.setState({ isLaunching: true })
333333
const response = await patchChallenge(challengeDetails.id, {
334334
winners,
335-
status: 'Completed'
335+
status: CHALLENGE_STATUS.COMPLETED
336336
})
337337
this.setState({
338338
isLaunching: false,

0 commit comments

Comments
 (0)