Skip to content

Commit d0552bf

Browse files
prevent changing prizes on completed challenges
1 parent aeb98b3 commit d0552bf

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
@@ -1296,6 +1296,9 @@ async function update (currentUser, challengeId, data, userToken, isFull) {
12961296
}
12971297

12981298
if (data.prizeSets) {
1299+
if (isDifferentPrizeSets(data.prizeSets, challenge.prizeSets) && finalStatus === constants.challengeStatuses.Completed) {
1300+
throw new errors.BadRequestError(`Cannot update prizeSets for challenges with status: ${finalStatus}!`)
1301+
}
12991302
const prizeSetsGroup = _.groupBy(data.prizeSets, 'type')
13001303
if (!prizeSetsGroup[constants.prizeSetTypes.ChallengePrizes] && _.get(challenge, 'overview.totalPrizes')) {
13011304
// remove the totalPrizes if challenge prizes are empty

0 commit comments

Comments
 (0)