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

Commit 2bbd2a1

Browse files
Merge pull request #76 from topcoder-platform/develop
Prod release
2 parents d600cd6 + c7b1e4e commit 2bbd2a1

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

Diff for: config/default.js

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ module.exports = {
8585
SYNC_V5_TERM_UUID: process.env.SYNC_V5_TERM_UUID || '317cd8f9-d66c-4f2a-8774-63c612d99cd4',
8686
SYNC_V5_WRITE_ENABLED: process.env.SYNC_V5_WRITE_ENABLED === 'true' || false,
8787

88+
DEV_TRACK_ID: '9b6fc876-f4d9-4ccb-9dfd-419247628825',
89+
8890
TIMEZONE: process.env.TIMEZONE || 'America/New_York',
8991

9092
IGNORED_ORIGINATORS: process.env.IGNORED_ORIGINATORS ? process.env.IGNORED_ORIGINATORS.split(',') : ['legacy-migration-script']

Diff for: src/services/ProcessorService.js

+25-24
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async function recreatePhases (legacyId, v5Phases, createdBy) {
7373
* @param {Boolean} isSelfService is the challenge self-service
7474
* @param {String} createdBy the created by
7575
*/
76-
async function syncChallengePhases (legacyId, v5Phases, createdBy, isSelfService) {
76+
async function syncChallengePhases (legacyId, v5Phases, createdBy, isSelfService, numOfReviewers) {
7777
const phaseTypes = await timelineService.getPhaseTypes()
7878
const phasesFromIFx = await timelineService.getChallengePhases(legacyId)
7979
logger.debug(`Phases from v5: ${JSON.stringify(v5Phases)}`)
@@ -84,33 +84,33 @@ async function syncChallengePhases (legacyId, v5Phases, createdBy, isSelfService
8484
logger.info(`v4 Phase: ${JSON.stringify(phase)}, v5 Equiv: ${JSON.stringify(v5Equivalent)}`)
8585
if (v5Equivalent) {
8686
// Compare duration and status
87-
if (v5Equivalent.duration * 1000 !== phase.duration * 1 || isSelfService) {
88-
// ||
89-
// (v5Equivalent.isOpen && _.toInteger(phase.phase_status_id) === constants.PhaseStatusTypes.Closed) ||
90-
// (!v5Equivalent.isOpen && _.toInteger(phase.phase_status_id) === constants.PhaseStatusTypes.Open)) {
91-
// const newStatus = v5Equivalent.isOpen
92-
// ? constants.PhaseStatusTypes.Open
93-
// : (new Date().getTime() <= new Date(v5Equivalent.scheduledEndDate).getTime() ? constants.PhaseStatusTypes.Scheduled : constants.PhaseStatusTypes.Closed)
94-
// update phase
95-
logger.debug(`Will update phase ${phaseName}/${v5Equivalent.name} from ${phase.duration} to duration ${v5Equivalent.duration * 1000} milli`)
96-
await timelineService.updatePhase(
97-
phase.project_phase_id,
98-
legacyId,
99-
v5Equivalent.scheduledStartDate,
100-
v5Equivalent.scheduledEndDate,
101-
v5Equivalent.duration * 1000,
102-
phase.phase_status_id
103-
)
104-
// newStatus)
105-
} else {
106-
logger.info(`Durations for ${phaseName} match: ${v5Equivalent.duration * 1000} === ${phase.duration}`)
107-
}
87+
// if (v5Equivalent.duration * 1000 !== phase.duration * 1 || isSelfService) {
88+
// ||
89+
// (v5Equivalent.isOpen && _.toInteger(phase.phase_status_id) === constants.PhaseStatusTypes.Closed) ||
90+
// (!v5Equivalent.isOpen && _.toInteger(phase.phase_status_id) === constants.PhaseStatusTypes.Open)) {
91+
// const newStatus = v5Equivalent.isOpen
92+
// ? constants.PhaseStatusTypes.Open
93+
// : (new Date().getTime() <= new Date(v5Equivalent.scheduledEndDate).getTime() ? constants.PhaseStatusTypes.Scheduled : constants.PhaseStatusTypes.Closed)
94+
// update phase
95+
logger.debug(`Will update phase ${phaseName}/${v5Equivalent.name} from ${phase.duration} to duration ${v5Equivalent.duration * 1000} milli`)
96+
await timelineService.updatePhase(
97+
phase.project_phase_id,
98+
legacyId,
99+
v5Equivalent.scheduledStartDate,
100+
v5Equivalent.scheduledEndDate,
101+
v5Equivalent.duration * 1000,
102+
phase.phase_status_id
103+
)
104+
// newStatus)
105+
// } else {
106+
// logger.info(`Durations for ${phaseName} match: ${v5Equivalent.duration * 1000} === ${phase.duration}`)
107+
// }
108108
} else {
109109
logger.info(`No v5 Equivalent Found for ${phaseName}`)
110110
}
111111
if (isSelfService && phaseName === 'Review') {
112112
// make sure to set the required reviewers to 2
113-
await createOrSetNumberOfReviewers(_.toString(phase.project_phase_id), '2', _.toString(createdBy))
113+
await createOrSetNumberOfReviewers(_.toString(phase.project_phase_id), _.toString(numOfReviewers), _.toString(createdBy))
114114
}
115115
}
116116
// TODO: What about iterative reviews? There can be many for the same challenge.
@@ -709,7 +709,8 @@ async function processMessage (message) {
709709
}
710710

711711
if (!_.get(message.payload, 'task.isTask')) {
712-
await syncChallengePhases(legacyId, message.payload.phases, createdByUserId, _.get(message, 'payload.legacy.selfService'))
712+
const numOfReviewers = 2
713+
await syncChallengePhases(legacyId, message.payload.phases, createdByUserId, _.get(message, 'payload.legacy.selfService'), numOfReviewers)
713714
} else {
714715
logger.info('Will skip syncing phases as the challenge is a task...')
715716
}

0 commit comments

Comments
 (0)