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

Commit aee1e95

Browse files
authored
Merge pull request #51 from topcoder-platform/hotfix/efforthours
fix effort hours
2 parents bfd6a48 + e254a9c commit aee1e95

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/scripts/migrations/010-fix-effort-hours.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* Populate the following properties on the challenges:
33
* - metadata.effortHoursEstimate
4-
* - metadata.effortHoursOffshore
5-
* - metadata.effortHoursOnshore
4+
* - metadata.offshoreEfforts
5+
* - metadata.onsiteEfforts
66
*/
77
global.Promise = require('bluebird')
88

@@ -15,8 +15,8 @@ const { execQuery, getEffortHoursFromIfx } = require('../../services/challengeIn
1515

1616
const mapping = {
1717
effortHoursEstimate: 88,
18-
effortHoursOffshore: 89,
19-
effortHoursOnshore: 90
18+
offshoreEfforts: 89,
19+
onsiteEfforts: 90
2020
}
2121

2222
const migrationFunction = {
@@ -57,6 +57,7 @@ const migrationFunction = {
5757
challenge.metadata[v5Index].value = legacyData[legacyIndex].value
5858
// logger.debug(`Metadata found in v5, updating v5 index: ${v5Index} ${legacyIndex} V5 Metadata ${JSON.stringify(challenge.metadata[v5Index])} -- Legacy Data ${JSON.stringify(legacyData[legacyIndex])}`)
5959
}
60+
challenge.metadata = _.filter(challenge.metadata, entry => entry.name !== 'effortHoursOffshore' && entry.name !== 'effortHoursOnshore')
6061
} else {
6162
// logger.debug(`Key ${key} not found in legacy array`)
6263
}

src/services/challengeService.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ async function buildV5Challenge (legacyId, challengeListing, challengeDetails) {
759759

760760
const effortHoursMapping = {
761761
effortHoursEstimate: 88,
762-
effortHoursOffshore: 89,
763-
effortHoursOnshore: 90
762+
offshoreEfforts: 89,
763+
onsiteEfforts: 90
764764
}
765765

766766
// const legacyEffortHoursData = await challengeInformixService.getEffortHoursFromIfx(legacyId)
@@ -793,7 +793,7 @@ async function buildV5Challenge (legacyId, challengeListing, challengeDetails) {
793793
metadata.push(newData)
794794
} else {
795795
metadata[v5Index].value = legacyEffortHoursData[legacyIndex].value
796-
logger.debug(`Metadata found in v5, updating v5 index: ${v5Index} ${legacyIndex} V5 Metadata ${JSON.stringify(metadata[v5Index])} -- Legacy Data ${JSON.stringify(legacyData[legacyIndex])}`)
796+
logger.debug(`Metadata found in v5, updating v5 index: ${v5Index} ${legacyIndex} V5 Metadata ${JSON.stringify(metadata[v5Index])}`)
797797
}
798798
} else {
799799
logger.debug(`Key ${key} not found in legacy array`)

0 commit comments

Comments
 (0)