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

Commit 4a5274b

Browse files
always set the copilot payment
1 parent 7a2a8af commit 4a5274b

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/services/ProcessorService.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,16 @@ async function associateChallengeTerms (v5Terms, legacyChallengeId, createdBy, u
255255
async function setCopilotPayment (challengeId, legacyChallengeId, prizeSets = [], createdBy, updatedBy, m2mToken) {
256256
try {
257257
const copilotPayment = _.get(_.find(prizeSets, p => p.type === config.COPILOT_PAYMENT_TYPE), 'prizes[0].value', 0)
258-
if (copilotPayment) {
259-
logger.debug('Fetching challenge copilot...')
260-
const res = await helper.getRequest(`${config.V5_RESOURCES_API_URL}?challengeId=${challengeId}&roleId=${config.COPILOT_ROLE_ID}`, m2mToken)
261-
const [copilotResource] = res.body
262-
if (!copilotResource) {
263-
logger.warn(`Copilot does not exist for challenge ${challengeId} (legacy: ${legacyChallengeId})`)
264-
return
265-
}
266-
logger.debug(`Setting Copilot Payment: ${copilotPayment} for legacyId ${legacyChallengeId} for copilot ${copilotResource.memberId}`)
267-
await copilotPaymentService.setManualCopilotPayment(legacyChallengeId, createdBy, updatedBy)
268-
await copilotPaymentService.setCopilotPayment(legacyChallengeId, copilotPayment, createdBy, updatedBy)
258+
logger.debug('Fetching challenge copilot...')
259+
const res = await helper.getRequest(`${config.V5_RESOURCES_API_URL}?challengeId=${challengeId}&roleId=${config.COPILOT_ROLE_ID}`, m2mToken)
260+
const [copilotResource] = res.body
261+
if (!copilotResource) {
262+
logger.warn(`Copilot does not exist for challenge ${challengeId} (legacy: ${legacyChallengeId})`)
263+
return
269264
}
265+
logger.debug(`Setting Copilot Payment: ${copilotPayment} for legacyId ${legacyChallengeId} for copilot ${copilotResource.memberId}`)
266+
await copilotPaymentService.setManualCopilotPayment(legacyChallengeId, createdBy, updatedBy)
267+
await copilotPaymentService.setCopilotPayment(legacyChallengeId, copilotPayment, createdBy, updatedBy)
270268
} catch (e) {
271269
logger.error('Failed to set the copilot payment!')
272270
logger.debug(e)

0 commit comments

Comments
 (0)