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

fix: don't apply tags when creating/updating challenges #117

Merged
merged 1 commit into from
Dec 8, 2023
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
6 changes: 4 additions & 2 deletions services/ChallengeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ const dbHelper = require('../utils/db-helper');
* @param {Object} event the event
*/
async function handleChallengeTagsUpdate(event) {
const tags = event.data.tags.map((tag) => tag.name);
const tags = event.data.tags;
await Promise.all(
event.data.challengeUUIDsList.map(async (challengeUUIDs) => {
if (_.isString(challengeUUIDs)) { // repoUrl
challengeUUIDs = await dbHelper.queryChallengeUUIDsByRepoUrl(challengeUUIDs);
}
return challengeUUIDs.map(async (challengeUUID) => await topcoderApiHelper.updateChallenge(challengeUUID, {tags}));
return challengeUUIDs.map(
async (challengeUUID) => await topcoderApiHelper.applySkillsSetToChallenge(challengeUUID, tags)
);
}).reduce((a, b) => _.concat(a, b), [])
).then((resps) => {
logger.debug(`handleChallengeTagsUpdate updated ${_.size(resps)} challenges successfully.`);
Expand Down
1 change: 0 additions & 1 deletion services/CopilotPaymentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ async function handlePaymentAdd(event, payment) {
const newChallenge = {
name: challengeTitle,
projectId: project.tcDirectId,
tags: project.tags ? project.tags.map((tag) => tag.name) : [],
detailedRequirements: challengeRequirements,
prizes: [payment.amount],
reviewType: 'INTERNAL'
Expand Down
1 change: 0 additions & 1 deletion services/IssueService.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ async function handleIssueCreate(event, issue, forceAssign = false) {
issue.challengeUUID = await topcoderApiHelper.createChallenge({
name: issue.title,
projectId,
tags: project.tags ? project.tags.map((tag) => tag.name) : [],
detailedRequirements: issue.body,
prizes: issue.prizes
});
Expand Down
3 changes: 2 additions & 1 deletion utils/topcoder-api-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function createChallenge(challenge) {
}],
timelineTemplateId: config.DEFAULT_TIMELINE_TEMPLATE_ID,
projectId: challenge.projectId,
tags: challenge.tags,
tags: [],
trackId: config.DEFAULT_TRACK_ID,
legacy: {
pureV5Task: true
Expand Down Expand Up @@ -189,6 +189,7 @@ async function applySkillsSetToChallenge(challengeId, tags) {
logger.debug(`Skills set applied successfully to the challenge ${challengeId}`);
return response.data;
} catch (err) {
// eslint-disable-next-line max-len
loggerFile.info(`EndPoint: POST /standardized-skills/challenge-skills/${challengeId}, POST parameters: ${circularJSON.stringify(payload)}, Status Code:null,
Error: 'Failed to apply skills set to the challenge.', Details: ${circularJSON.stringify(err)}`);
logger.error(`Response Data: ${JSON.stringify(err.response.data)}`);
Expand Down