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

Commit a149dd9

Browse files
committed
Handle default scorecards
1 parent 4185c9b commit a149dd9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/services/ProcessorService.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ async function recreatePhases (legacyId, v5Phases, createdBy) {
6666
await timelineService.insertPhaseDependency(registrationPhaseId, checkpointSubmissionPhaseId, 1, createdBy)
6767
await timelineService.insertPhaseDependency(checkpointSubmissionPhaseId, checkpointScreeningPhaseId, 0, createdBy)
6868
await timelineService.insertPhaseDependency(checkpointScreeningPhaseId, checkpointReviewPhaseId, 0, createdBy)
69+
70+
logger.info(`Creating default scorecard records for checkpoint phases`)
71+
//30001364 is the default checkpoint screening scorecard for studio (https://software.topcoder-dev.com/review/actions/ViewScorecard?scid=30001364)
72+
await timelineService.insertScorecardId(checkpointScreeningPhaseId, 30001364, createdBy)
73+
74+
//30001364 is the default checkpoint review scorecard for studio (https://software.topcoder-dev.com/review/actions/ViewScorecard?scid=30001004)
75+
await timelineService.insertScorecardId(checkpointReviewPhaseId, 30001004, createdBy)
76+
77+
6978
}
7079
} else if (!phaseLegacyId) {
7180
logger.warn(`Could not create phase ${phase.name} on legacy!`)

src/services/timelineService.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const QUERY_UPDATE_TIMELINE_NOTIFICATIONS = 'UPDATE project_info SET value = "On
2929

3030
const QUERY_INSERT_CHALLENGE_PHASE_DEPENDENCY = 'INSERT INTO phase_dependency (dependency_phase_id, dependent_phase_id, dependency_start, dependent_start, lag_time, create_user, create_date, modify_user, modify_date) VALUES (?, ?, ?, 1, 0, ?, CURRENT, ?, CURRENT)'
3131
const QUERY_GET_PROJECT_PHASE_ID = 'SELECT project_phase_id as project_phase_id FROM project_phase WHERE project_id = %d AND phase_type_id = %d'
32+
33+
const QUERY_INSERT_CHALLENGE_PHASE_SCORECARD_ID = 'INSERT INTO phase_criteria (project_phase_id, phase_criteria_type_id, parameter, create_user, create_date, modify_user, modify_date) VALUES (?, 1, ?, ?, CURRENT, ?, CURRENT)'
34+
3235
/**
3336
* Formats a date into a format supported by ifx
3437
* @param {String} dateStr the date in string format
@@ -84,6 +87,25 @@ async function insertPhaseDependency(dependencyPhaseId, dependentPhaseId, depend
8487
}
8588
return result
8689
}
90+
91+
92+
async function insertScorecardId(projectPhaseId, scorecardId, createdBy){
93+
94+
logger.info(`Creating scorecard ID ${projectPhaseId} use scorecard ${scorecardId}`)
95+
const connection = await helper.getInformixConnection()
96+
let result = null
97+
try {
98+
let query = await prepare(connection, QUERY_INSERT_CHALLENGE_PHASE_SCORECARD_ID)
99+
result = await query.executeAsync([projectPhaseId, scorecardId, createdBy, createdBy])
100+
} catch (e) {
101+
logger.error(`Error in 'insertScorecardId' ${e}`)
102+
throw e
103+
} finally {
104+
await connection.closeAsync()
105+
}
106+
return result
107+
}
108+
87109
/**
88110
* Gets phase for the given phase type for the given challenge ID
89111
*/

0 commit comments

Comments
 (0)