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

Prod deployment #84

Merged
merged 12 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ const challengeStatusOrders = {
cancelled: 2
}

const challengeStatuses = {
Completed: 'Completed',
}

module.exports = {
prizeSetTypes,
challengeStatusOrders
challengeStatusOrders,
challengeStatuses
}
11 changes: 7 additions & 4 deletions src/services/challengeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ async function createChallenge (challenge) {
*/
async function updateChallenge (challenge) {
try {
const updateChallenge = new Challenge(_.omit(challenge, ['created', 'createdBy']))
if (challenge.task && (challenge.status === constants.challengeStatuses.Completed || _.get(challenge, 'winners.length') > 0)) {
_.unset(challenge, 'task')
}
const updateChallenge = new Challenge(_.omit(challenge, ['created', 'createdBy', 'name']))
// numOfSubmissions and numOfRegistrants are not stored in dynamo, they're calclated by the ES processor
await Challenge.update({ id: challenge.id }, _.omit(updateChallenge, challengePropertiesToOmitFromDynamo))
await getESClient().update({
Expand All @@ -88,7 +91,7 @@ async function updateChallenge (challenge) {
id: challenge.id,
body: {
doc: {
..._.omit(challenge, ['created', 'createdBy']),
..._.omit(challenge, ['created', 'createdBy', 'name']),
groups: _.filter(challenge.groups, g => _.toString(g).toLowerCase() !== 'null')
}
}
Expand Down Expand Up @@ -551,8 +554,8 @@ async function buildV5Challenge (legacyId, challengeListing, challengeDetails) {
detailRequirement = challengeDetails.introduction + '<br />' + detailRequirement
}
if (_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== 'null' &&
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== '' &&
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== 'Please read above') {
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== '' &&
_.get(challengeDetails, 'finalSubmissionGuidelines', '').trim() !== 'Please read above') {
detailRequirement += '<br /><br /><h2>Final Submission Guidelines</h2>' + challengeDetails.finalSubmissionGuidelines
}
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/util/conversionMappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const V4_SUBTRACKS = {
}

const MARATHON_MATCH_TAG = 'Marathon Match'
const DATA_SCIENCE_MATCH_TAG = "Data Science Match"
const DATA_SCIENCE_TAG = 'Data Science'

const FE_DESIGN_TAG = 'Front-End Design'
Expand Down Expand Up @@ -115,7 +116,7 @@ module.exports = {
V5_TO_V4: {
[V5_TRACK_IDS.DATA_SCIENCE]: {
[V5_TYPE_IDS.CHALLENGE]: (tags) => {
if (_.includes(tags, MARATHON_MATCH_TAG)) {
if (_.includes(tags, MARATHON_MATCH_TAG) || _.includes(tags, DATA_SCIENCE_MATCH_TAG)) {
return buildV4Data(V4_TRACKS.DATA_SCIENCE, V4_SUBTRACKS.MARATHON_MATCH, false)
} else {
return buildV4Data(V4_TRACKS.DEVELOP, V4_SUBTRACKS.CODE, false, [DATA_SCIENCE_TAG])
Expand All @@ -142,7 +143,8 @@ module.exports = {
},
V4_TO_V5: {
[V4_TRACKS.DATA_SCIENCE]: {
[V4_SUBTRACKS.MARATHON_MATCH]: () => buildV5Data(V5_TRACK_IDS.DATA_SCIENCE, V5_TYPE_IDS.CHALLENGE, [MARATHON_MATCH_TAG])
// categorizes non competitive programming marathon matches as Data Science Match
[V4_SUBTRACKS.MARATHON_MATCH]: () => buildV5Data(V5_TRACK_IDS.DATA_SCIENCE, V5_TYPE_IDS.CHALLENGE, [DATA_SCIENCE_MATCH_TAG])
},
[V4_TRACKS.DESIGN]: {
[V4_SUBTRACKS.DESIGN_FIRST_2_FINISH]: (isTask) => buildV5Data(V5_TRACK_IDS.DESIGN, isTask ? V5_TYPE_IDS.TASK : V5_TYPE_IDS.FIRST_2_FINISH),
Expand Down