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

Commit 7b85101

Browse files
Merge pull request #84 from topcoder-platform/develop
Prod deployment
2 parents 9495652 + 82efb88 commit 7b85101

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
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: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ async function createChallenge (challenge) {
7878
*/
7979
async function updateChallenge (challenge) {
8080
try {
81-
const updateChallenge = new Challenge(_.omit(challenge, ['created', 'createdBy']))
81+
if (challenge.task && (challenge.status === constants.challengeStatuses.Completed || _.get(challenge, 'winners.length') > 0)) {
82+
_.unset(challenge, 'task')
83+
}
84+
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))
8487
await getESClient().update({
@@ -88,7 +91,7 @@ async function updateChallenge (challenge) {
8891
id: challenge.id,
8992
body: {
9093
doc: {
91-
..._.omit(challenge, ['created', 'createdBy']),
94+
..._.omit(challenge, ['created', 'createdBy', 'name']),
9295
groups: _.filter(challenge.groups, g => _.toString(g).toLowerCase() !== 'null')
9396
}
9497
}
@@ -551,8 +554,8 @@ async function buildV5Challenge (legacyId, challengeListing, challengeDetails) {
551554
detailRequirement = challengeDetails.introduction + '<br />' + detailRequirement
552555
}
553556
if (_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== 'null' &&
554-
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== '' &&
555-
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== 'Please read above') {
557+
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== '' &&
558+
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== 'Please read above') {
556559
detailRequirement += '<br /><br /><h2>Final Submission Guidelines</h2>' + challengeDetails.finalSubmissionGuidelines
557560
}
558561
} else {

src/util/conversionMappings.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const V4_SUBTRACKS = {
8686
}
8787

8888
const MARATHON_MATCH_TAG = 'Marathon Match'
89+
const DATA_SCIENCE_MATCH_TAG = "Data Science Match"
8990
const DATA_SCIENCE_TAG = 'Data Science'
9091

9192
const FE_DESIGN_TAG = 'Front-End Design'
@@ -115,7 +116,7 @@ module.exports = {
115116
V5_TO_V4: {
116117
[V5_TRACK_IDS.DATA_SCIENCE]: {
117118
[V5_TYPE_IDS.CHALLENGE]: (tags) => {
118-
if (_.includes(tags, MARATHON_MATCH_TAG)) {
119+
if (_.includes(tags, MARATHON_MATCH_TAG) || _.includes(tags, DATA_SCIENCE_MATCH_TAG)) {
119120
return buildV4Data(V4_TRACKS.DATA_SCIENCE, V4_SUBTRACKS.MARATHON_MATCH, false)
120121
} else {
121122
return buildV4Data(V4_TRACKS.DEVELOP, V4_SUBTRACKS.CODE, false, [DATA_SCIENCE_TAG])
@@ -142,7 +143,8 @@ module.exports = {
142143
},
143144
V4_TO_V5: {
144145
[V4_TRACKS.DATA_SCIENCE]: {
145-
[V4_SUBTRACKS.MARATHON_MATCH]: () => buildV5Data(V5_TRACK_IDS.DATA_SCIENCE, V5_TYPE_IDS.CHALLENGE, [MARATHON_MATCH_TAG])
146+
// categorizes non competitive programming marathon matches as Data Science Match
147+
[V4_SUBTRACKS.MARATHON_MATCH]: () => buildV5Data(V5_TRACK_IDS.DATA_SCIENCE, V5_TYPE_IDS.CHALLENGE, [DATA_SCIENCE_MATCH_TAG])
146148
},
147149
[V4_TRACKS.DESIGN]: {
148150
[V4_SUBTRACKS.DESIGN_FIRST_2_FINISH]: (isTask) => buildV5Data(V5_TRACK_IDS.DESIGN, isTask ? V5_TYPE_IDS.TASK : V5_TYPE_IDS.FIRST_2_FINISH),

0 commit comments

Comments
 (0)