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

Commit 5a40fe9

Browse files
authored
Merge pull request #103 from topcoder-platform/multi-round-sync
Restructuring and some additional logging
2 parents 53da312 + 66d04bc commit 5a40fe9

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/services/ProcessorService.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ async function recreatePhases (legacyId, v5Phases, createdBy) {
5252
phase.duration * 1000,
5353
createdBy
5454
)
55+
//Handle checkpoint phases
56+
//Magic numbers: 15=checkpoint submission, 16=checkpoint screen, 17=checkpoint review, 1=registration
57+
//For dependencyStart: 1=start, 0=end
58+
if(phaseLegacyId==17){
59+
logger.info(`Creating phase dependencies for checkpoint phases`)
60+
61+
registrationPhaseId = await timelineService.getProjectPhaseId(legacyId, 1)
62+
checkpointSubmissionPhaseId = await timelineService.getProjectPhaseId(legacyId, 15)
63+
checkpointScreeningPhaseId = await timelineService.getProjectPhaseId(legacyId, 16)
64+
checkpointReviewPhaseId = await timelineService.getProjectPhaseId(legacyId, 17)
65+
66+
await timelineService.insertPhaseDependency(registrationPhaseId, checkpointSubmissionPhaseId, 1, createdBy)
67+
await timelineService.insertPhaseDependency(checkpointSubmissionPhaseId, checkpointScreeningPhaseId, 0, createdBy)
68+
await timelineService.insertPhaseDependency(checkpointScreeningPhaseId, checkpointReviewPhaseId, 0, createdBy)
69+
}
5570
} else if (!phaseLegacyId) {
5671
logger.warn(`Could not create phase ${phase.name} on legacy!`)
5772
}

src/services/timelineService.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ async function getPhaseTypes () {
6767
}
6868

6969
async function insertPhaseDependency(dependencyPhaseId, dependentPhaseId, dependencyStart, createdBy){
70+
71+
logger.info(`Creating phase dependency ${dependencyPhaseId} to ${dependentPhaseId} at ${dependencyStart}`)
7072
const connection = await helper.getInformixConnection()
7173
let result = null
7274
try {
@@ -185,18 +187,6 @@ async function createPhase (challengeLegacyId, phaseTypeId, statusTypeId, schedu
185187
])
186188
await connection.commitTransactionAsync()
187189

188-
//Handle checkpoint phases
189-
//Magic numbers: 15=checkpoint submission, 16=checkpoint screen, 17=checkpoint review, 1=registration
190-
//For dependencyStart: 1=start, 0=end
191-
if(phaseTypeId==17){
192-
registrationPhaseId = await this.getProjectPhaseId(challengeLegacyId, 1)
193-
checkpointSubmissionPhaseId = await this.getProjectPhaseId(challengeLegacyId, 15)
194-
checkpointScreeningPhaseId = await this.getProjectPhaseId(challengeLegacyId, 16)
195-
checkpointReviewPhaseId = await this.getProjectPhaseId(challengeLegacyId, 17)
196-
await this.insertPhaseDependency(registrationPhaseId, checkpointSubmissionPhaseId, 1, createdBy)
197-
await this.insertPhaseDependency(checkpointSubmissionPhaseId, checkpointScreeningPhaseId, 0, createdBy)
198-
await this.insertPhaseDependency(checkpointScreeningPhaseId, checkpointReviewPhaseId, 0, createdBy)
199-
}
200190
} catch (e) {
201191
logger.error(`Error in 'createPhase' ${e}, rolling back transaction`)
202192
await connection.rollbackTransactionAsync()
@@ -291,5 +281,7 @@ module.exports = {
291281
updatePhase,
292282
enableTimelineNotifications,
293283
createPhase,
294-
dropPhase
284+
dropPhase,
285+
insertPhaseDependency,
286+
getProjectPhaseId
295287
}

0 commit comments

Comments
 (0)