From 1fe253221c4eee02ae32a3cf4419c46678981736 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 1 Apr 2021 03:17:51 +0300 Subject: [PATCH 1/2] use onsiteEfforts and offshoreEfforts --- src/utils/metadataExtractor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/metadataExtractor.js b/src/utils/metadataExtractor.js index dea646e..c8fb45c 100644 --- a/src/utils/metadataExtractor.js +++ b/src/utils/metadataExtractor.js @@ -165,7 +165,7 @@ function extractEstimateEffortHours (challenge, defaultValue) { * @param {Any} defaultValue the default value */ function extractEstimateEffortOffshore (challenge, defaultValue) { - const entry = getMeta(challenge.metadata, 'effortHoursOffshore') + const entry = getMeta(challenge.metadata, 'offshoreEfforts') if (!entry) return _.toString(defaultValue) return _.toNumber(entry.value) } @@ -176,7 +176,7 @@ function extractEstimateEffortOffshore (challenge, defaultValue) { * @param {Any} defaultValue the default value */ function extractEstimateEffortOnsite (challenge, defaultValue) { - const entry = getMeta(challenge.metadata, 'effortHoursOnshore') + const entry = getMeta(challenge.metadata, 'onsiteEfforts') if (!entry) return _.toString(defaultValue) return _.toNumber(entry.value) } From 7a2a8af6f0d959416cc2ae4e20732bdc3a678428 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Tue, 6 Apr 2021 01:13:41 +0300 Subject: [PATCH 2/2] Set the copilot payment to 0 if it's not defined --- src/services/ProcessorService.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/services/ProcessorService.js b/src/services/ProcessorService.js index c4e0d54..cb6baeb 100644 --- a/src/services/ProcessorService.js +++ b/src/services/ProcessorService.js @@ -254,7 +254,7 @@ async function associateChallengeTerms (v5Terms, legacyChallengeId, createdBy, u */ async function setCopilotPayment (challengeId, legacyChallengeId, prizeSets = [], createdBy, updatedBy, m2mToken) { try { - const copilotPayment = _.get(_.find(prizeSets, p => p.type === config.COPILOT_PAYMENT_TYPE), 'prizes[0].value', null) + const copilotPayment = _.get(_.find(prizeSets, p => p.type === config.COPILOT_PAYMENT_TYPE), 'prizes[0].value', 0) if (copilotPayment) { logger.debug('Fetching challenge copilot...') 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 = [] return } logger.debug(`Setting Copilot Payment: ${copilotPayment} for legacyId ${legacyChallengeId} for copilot ${copilotResource.memberId}`) - if (copilotPayment !== null && copilotPayment >= 0) { - await copilotPaymentService.setManualCopilotPayment(legacyChallengeId, createdBy, updatedBy) - } + await copilotPaymentService.setManualCopilotPayment(legacyChallengeId, createdBy, updatedBy) await copilotPaymentService.setCopilotPayment(legacyChallengeId, copilotPayment, createdBy, updatedBy) } } catch (e) {