Skip to content

Commit 66e8775

Browse files
Update available challenge statuses
1 parent 8f6bd4f commit 66e8775

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

app-constants.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ const prizeSetTypes = {
1616
const challengeStatuses = {
1717
New: 'New',
1818
Draft: 'Draft',
19-
Canceled: 'Canceled',
19+
Cancelled: 'Cancelled',
2020
Active: 'Active',
21-
Completed: 'Completed'
21+
Completed: 'Completed',
22+
Deleted: 'Deleted',
23+
CancelledFailedReview: 'Cancelled - Failed Review',
24+
CancelledFailedScreening: 'Cancelled - Failed Screening',
25+
CancelledZeroSubmissions: 'Cancelled - Zero Submissions',
26+
CancelledWinnerUnresponsive: 'Cancelled - Winner Unresponsive',
27+
CancelledClientRequest: 'Cancelled - Client Request',
28+
CancelledRequirementsInfeasible: 'Cancelled - Requirements Infeasible',
29+
CancelledZeroRegistrations: 'Cancelled - Zero Registrations'
2230
}
2331

2432
const validChallengeParams = {

docs/swagger.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ paths:
129129
description: Filter by status, case-insensitive, partial matches are allowed.
130130
required: false
131131
type: string
132-
enum: ['New', 'Draft', 'Canceled', 'Active', 'Completed']
132+
enum: ['New', 'Draft', 'Cancelled', 'Active', 'Completed']
133133
- name: currentPhaseId
134134
in: query
135135
description: Filter by id of the current phase
@@ -1858,7 +1858,7 @@ definitions:
18581858
status:
18591859
type: string
18601860
description: the status
1861-
enum: ['New', 'Draft', 'Canceled', 'Active', 'Completed']
1861+
enum: ['New', 'Draft', 'Cancelled', 'Active', 'Completed']
18621862
attachments:
18631863
type: array
18641864
items:
@@ -2160,7 +2160,7 @@ definitions:
21602160
status:
21612161
type: string
21622162
description: the status
2163-
enum: ['New', 'Draft', 'Canceled', 'Active', 'Completed']
2163+
enum: ['New', 'Draft', 'Cancelled', 'Active', 'Completed']
21642164
groups:
21652165
type: array
21662166
items:
@@ -2256,7 +2256,7 @@ definitions:
22562256
status:
22572257
type: string
22582258
description: the status
2259-
enum: ['New', 'Draft', 'Canceled', 'Active', 'Completed']
2259+
enum: ['New', 'Draft', 'Cancelled', 'Active', 'Completed']
22602260
attachments:
22612261
type: array
22622262
items:

src/services/ChallengeService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ async function update (currentUser, challengeId, data, userToken, isFull) {
763763
}
764764

765765
await validateChallengeData(data)
766-
if ((challenge.status === constants.challengeStatuses.Completed || challenge.status === constants.challengeStatuses.Canceled) && data.status && data.status !== challenge.status) {
766+
if ((challenge.status === constants.challengeStatuses.Completed || challenge.status === constants.challengeStatuses.Cancelled) && data.status && data.status !== challenge.status) {
767767
throw new errors.BadRequestError(`Cannot change ${challenge.status} challenge status to ${data.status} status`)
768768
}
769769

test/e2e/challenge.api.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ describe('challenge API E2E tests', () => {
475475
.set('Authorization', `Bearer ${config.M2M_UPDATE_ACCESS_TOKEN}`)
476476
.send(challengeData)
477477
should.equal(response.status, 400)
478-
should.equal(response.body.message, '"status" must be one of [New, Draft, Canceled, Active, Completed]')
478+
should.equal(response.body.message, '"status" must be one of [New, Draft, Cancelled, Active, Completed]')
479479
})
480480

481481
it('create challenge - unexpected field', async () => {
@@ -896,7 +896,7 @@ describe('challenge API E2E tests', () => {
896896
.set('Authorization', `Bearer ${config.ADMIN_TOKEN}`)
897897
.query({ status: 'abc' })
898898
should.equal(response.status, 400)
899-
should.equal(response.body.message, '"status" must be one of [New, Draft, Canceled, Active, Completed]')
899+
should.equal(response.body.message, '"status" must be one of [New, Draft, Cancelled, Active, Completed]')
900900
})
901901

902902
it('search challenges - invalid createdDateStart', async () => {

0 commit comments

Comments
 (0)