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

Commit c8feca9

Browse files
authored
Merge pull request #52 from topcoder-platform/fix-zero-copilot-payments
Fix zero copilot payments
2 parents dda1988 + 7a2a8af commit c8feca9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/services/ProcessorService.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ async function associateChallengeTerms (v5Terms, legacyChallengeId, createdBy, u
254254
*/
255255
async function setCopilotPayment (challengeId, legacyChallengeId, prizeSets = [], createdBy, updatedBy, m2mToken) {
256256
try {
257-
const copilotPayment = _.get(_.find(prizeSets, p => p.type === config.COPILOT_PAYMENT_TYPE), 'prizes[0].value', null)
257+
const copilotPayment = _.get(_.find(prizeSets, p => p.type === config.COPILOT_PAYMENT_TYPE), 'prizes[0].value', 0)
258258
if (copilotPayment) {
259259
logger.debug('Fetching challenge copilot...')
260260
const res = await helper.getRequest(`${config.V5_RESOURCES_API_URL}?challengeId=${challengeId}&roleId=${config.COPILOT_ROLE_ID}`, m2mToken)
@@ -264,9 +264,7 @@ async function setCopilotPayment (challengeId, legacyChallengeId, prizeSets = []
264264
return
265265
}
266266
logger.debug(`Setting Copilot Payment: ${copilotPayment} for legacyId ${legacyChallengeId} for copilot ${copilotResource.memberId}`)
267-
if (copilotPayment !== null && copilotPayment >= 0) {
268-
await copilotPaymentService.setManualCopilotPayment(legacyChallengeId, createdBy, updatedBy)
269-
}
267+
await copilotPaymentService.setManualCopilotPayment(legacyChallengeId, createdBy, updatedBy)
270268
await copilotPaymentService.setCopilotPayment(legacyChallengeId, copilotPayment, createdBy, updatedBy)
271269
}
272270
} catch (e) {

0 commit comments

Comments
 (0)