Skip to content

Commit d266b44

Browse files
minor fixes on pureV5 flag
1 parent c3c94d9 commit d266b44

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/services/ChallengeService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ async function createChallenge (currentUser, challenge) {
902902
throw new errors.BadRequestError('You cannot create an Active challenge. Please create a Draft challenge and then change the status to Active.')
903903
}
904904
const { directProjectId } = await helper.ensureProjectExist(challenge.projectId, currentUser)
905-
if (_.get(challenge, 'legacy.pureV5Task')) {
905+
if (_.get(challenge, 'legacy.pureV5Task') || _.get(challenge, 'legacy.pureV5')) {
906906
_.set(challenge, 'legacy.directProjectId', directProjectId)
907907
}
908908
const { track, type } = await validateChallengeData(challenge)
@@ -1292,7 +1292,7 @@ async function update (currentUser, challengeId, data, isFull) {
12921292
}
12931293
if (data.status) {
12941294
if (data.status === constants.challengeStatuses.Active) {
1295-
if (!_.get(challenge, 'legacy.pureV5Task') && _.isUndefined(_.get(challenge, 'legacyId'))) {
1295+
if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && _.isUndefined(_.get(challenge, 'legacyId'))) {
12961296
throw new errors.BadRequestError('You cannot activate the challenge as it has not been created on legacy yet. Please try again later or contact support.')
12971297
}
12981298
// if activating a challenge, the challenge must have a billing account id
@@ -1302,7 +1302,7 @@ async function update (currentUser, challengeId, data, isFull) {
13021302
}
13031303
}
13041304
if (data.status === constants.challengeStatuses.Completed) {
1305-
if (!_.get(challenge, 'legacy.pureV5Task') && challenge.status !== constants.challengeStatuses.Active) {
1305+
if (!_.get(challenge, 'legacy.pureV5Task') && !_.get(challenge, 'legacy.pureV5') && challenge.status !== constants.challengeStatuses.Active) {
13061306
throw new errors.BadRequestError('You cannot mark a Draft challenge as Completed')
13071307
}
13081308
}

0 commit comments

Comments
 (0)