@@ -15,10 +15,10 @@ const phaseIdGen = new IDGenerator('project_phase_id_seq')
15
15
16
16
const QUERY_GET_PHASE_TYPES = 'SELECT phase_type_id, name FROM phase_type_lu'
17
17
18
- const QUERY_GET_CHALLENGE_PHASES = 'SELECT project_phase_id, scheduled_start_time, scheduled_end_time, duration, phase_status_id, phase_type_id FROM project_phase WHERE project_id = %d'
18
+ const QUERY_GET_CHALLENGE_PHASES = 'SELECT project_phase_id, fixed_start_time, scheduled_start_time, scheduled_end_time, duration, phase_status_id, phase_type_id FROM project_phase WHERE project_id = %d'
19
19
const QUERY_DROP_CHALLENGE_PHASE = 'DELETE FROM project_phase WHERE project_id = ? AND project_phase_id = ?'
20
20
const QUERY_INSERT_CHALLENGE_PHASE = 'INSERT INTO project_phase (project_phase_id, project_id, phase_type_id, phase_status_id, scheduled_start_time, scheduled_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, CURRENT, ?, CURRENT)'
21
- const QUERY_UPDATE_CHALLENGE_PHASE = 'UPDATE project_phase SET scheduled_start_time = ?, scheduled_end_time = ?, duration = ?, phase_status_id = ? WHERE project_phase_id = %d and project_id = %d'
21
+ const QUERY_UPDATE_CHALLENGE_PHASE = 'UPDATE project_phase SET fixed_start_time = ?, scheduled_start_time = ?, scheduled_end_time = ?, duration = ?, phase_status_id = ? WHERE project_phase_id = %d and project_id = %d'
22
22
23
23
const QUERY_DROP_CHALLENGE_PHASE_CRITERIA = 'DELETE FROM phase_criteria WHERE project_phase_id = ?'
24
24
@@ -37,6 +37,9 @@ const QUERY_INSERT_CHALLENGE_PHASE_SCORECARD_ID = 'INSERT INTO phase_criteria (p
37
37
* @param {String } dateStr the date in string format
38
38
*/
39
39
function formatDate ( dateStr ) {
40
+ if ( ! dateStr ) {
41
+ return null
42
+ }
40
43
const date = momentTZ . tz ( dateStr , config . TIMEZONE ) . format ( 'YYYY-MM-DD HH:mm:ss' )
41
44
logger . info ( `Formatting date ${ dateStr } New Date ${ date } ` )
42
45
return date
@@ -228,18 +231,19 @@ async function createPhase (challengeLegacyId, phaseTypeId, statusTypeId, schedu
228
231
* Update a phase in IFX
229
232
* @param {Number } phaseId the phase ID
230
233
* @param {Number } challengeLegacyId the legacy challenge ID
234
+ * @param {Date } fixedStartTime the fixed start date
231
235
* @param {Date } startTime the scheduled start date
232
236
* @param {Date } endTime the scheduled end date
233
237
* @param {Date } duration the duration
234
238
* @param {Number } statusTypeId the status type ID
235
239
*/
236
- async function updatePhase ( phaseId , challengeLegacyId , startTime , endTime , duration , statusTypeId ) {
240
+ async function updatePhase ( phaseId , challengeLegacyId , fixedStartTime , startTime , endTime , duration , statusTypeId ) {
237
241
const connection = await helper . getInformixConnection ( )
238
242
let result = null
239
243
try {
240
244
// await connection.beginTransactionAsync()
241
245
const query = await prepare ( connection , util . format ( QUERY_UPDATE_CHALLENGE_PHASE , phaseId , challengeLegacyId ) )
242
- result = await query . executeAsync ( [ formatDate ( startTime ) , formatDate ( endTime ) , duration , statusTypeId ] )
246
+ result = await query . executeAsync ( [ formatDate ( fixedStartTime ) , formatDate ( startTime ) , formatDate ( endTime ) , duration , statusTypeId ] )
243
247
// await connection.commitTransactionAsync()
244
248
} catch ( e ) {
245
249
logger . error ( `Error in 'updatePhase' ${ e } , rolling back transaction` )
0 commit comments