Skip to content

Commit 78a2587

Browse files
committed
fix(challenge update): disallow updating phase/startdate for completed/cancelled challenges
1 parent 20c4a1d commit 78a2587

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/ChallengeService.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1517,8 +1517,8 @@ async function update (currentUser, challengeId, data, isFull) {
15171517
}
15181518

15191519
if (data.phases || data.startDate) {
1520-
if (!(challenge.status === constants.challengeStatuses.Active || challenge.status === constants.challengeStatuses.Draft)) {
1521-
throw new BadRequestError(`Challenge phase/start date can only be modify for "Active" and "Draft" challenges.`)
1520+
if (challenge.status === constants.challengeStatuses.Completed || challenge.status.indexOf(constants.challengeStatuses.Cancelled) > -1) {
1521+
throw new BadRequestError(`Challenge phase/start date can not be modified for Completed or Cancelled challenges.`)
15221522
}
15231523

15241524
if (data.phases && data.phases.length > 0) {

0 commit comments

Comments
 (0)