Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 82efb88

Browse files
Merge pull request #83 from topcoder-platform/PROD-2376-legacy
ignore challenge.task info for completed challenges on legacy
2 parents 3dc0eaa + 6d36da3 commit 82efb88

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/constants.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ const challengeStatusOrders = {
1717
cancelled: 2
1818
}
1919

20+
const challengeStatuses = {
21+
Completed: 'Completed',
22+
}
23+
2024
module.exports = {
2125
prizeSetTypes,
22-
challengeStatusOrders
26+
challengeStatusOrders,
27+
challengeStatuses
2328
}

src/services/challengeService.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ async function createChallenge (challenge) {
7878
*/
7979
async function updateChallenge (challenge) {
8080
try {
81+
if (challenge.task && (challenge.status === constants.challengeStatuses.Completed || _.get(challenge, 'winners.length') > 0)) {
82+
_.unset(challenge, 'task')
83+
}
8184
const updateChallenge = new Challenge(_.omit(challenge, ['created', 'createdBy', 'name']))
8285
// numOfSubmissions and numOfRegistrants are not stored in dynamo, they're calclated by the ES processor
8386
await Challenge.update({ id: challenge.id }, _.omit(updateChallenge, challengePropertiesToOmitFromDynamo))

0 commit comments

Comments
 (0)