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

Commit 946fd86

Browse files
authored
Merge pull request #117 from dhruvit-r/develop
fix: don't apply tags when creating/updating challenges
2 parents 66f1534 + e056f93 commit 946fd86

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

services/ChallengeService.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ const dbHelper = require('../utils/db-helper');
2020
* @param {Object} event the event
2121
*/
2222
async function handleChallengeTagsUpdate(event) {
23-
const tags = event.data.tags.map((tag) => tag.name);
23+
const tags = event.data.tags;
2424
await Promise.all(
2525
event.data.challengeUUIDsList.map(async (challengeUUIDs) => {
2626
if (_.isString(challengeUUIDs)) { // repoUrl
2727
challengeUUIDs = await dbHelper.queryChallengeUUIDsByRepoUrl(challengeUUIDs);
2828
}
29-
return challengeUUIDs.map(async (challengeUUID) => await topcoderApiHelper.updateChallenge(challengeUUID, {tags}));
29+
return challengeUUIDs.map(
30+
async (challengeUUID) => await topcoderApiHelper.applySkillsSetToChallenge(challengeUUID, tags)
31+
);
3032
}).reduce((a, b) => _.concat(a, b), [])
3133
).then((resps) => {
3234
logger.debug(`handleChallengeTagsUpdate updated ${_.size(resps)} challenges successfully.`);

services/CopilotPaymentService.js

-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ async function handlePaymentAdd(event, payment) {
194194
const newChallenge = {
195195
name: challengeTitle,
196196
projectId: project.tcDirectId,
197-
tags: project.tags ? project.tags.map((tag) => tag.name) : [],
198197
detailedRequirements: challengeRequirements,
199198
prizes: [payment.amount],
200199
reviewType: 'INTERNAL'

services/IssueService.js

-1
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,6 @@ async function handleIssueCreate(event, issue, forceAssign = false) {
635635
issue.challengeUUID = await topcoderApiHelper.createChallenge({
636636
name: issue.title,
637637
projectId,
638-
tags: project.tags ? project.tags.map((tag) => tag.name) : [],
639638
detailedRequirements: issue.body,
640639
prizes: issue.prizes
641640
});

utils/topcoder-api-helper.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async function createChallenge(challenge) {
7676
}],
7777
timelineTemplateId: config.DEFAULT_TIMELINE_TEMPLATE_ID,
7878
projectId: challenge.projectId,
79-
tags: challenge.tags,
79+
tags: [],
8080
trackId: config.DEFAULT_TRACK_ID,
8181
legacy: {
8282
pureV5Task: true
@@ -189,6 +189,7 @@ async function applySkillsSetToChallenge(challengeId, tags) {
189189
logger.debug(`Skills set applied successfully to the challenge ${challengeId}`);
190190
return response.data;
191191
} catch (err) {
192+
// eslint-disable-next-line max-len
192193
loggerFile.info(`EndPoint: POST /standardized-skills/challenge-skills/${challengeId}, POST parameters: ${circularJSON.stringify(payload)}, Status Code:null,
193194
Error: 'Failed to apply skills set to the challenge.', Details: ${circularJSON.stringify(err)}`);
194195
logger.error(`Response Data: ${JSON.stringify(err.response.data)}`);

0 commit comments

Comments
 (0)