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

Commit 25bfb2b

Browse files
committed
Use the *correct* sequence generator when adding new project phases.
1 parent 3664bad commit 25bfb2b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/services/timelineService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ const momentTZ = require('moment-timezone')
99
const IDGenerator = require('../common/idGenerator')
1010
const helper = require('../common/helper')
1111

12-
const phaseIdGen = new IDGenerator('prize_id_seq')
12+
const phaseIdGen = new IDGenerator('project_phase_id_seq')
1313

1414
const QUERY_GET_PHASE_TYPES = 'SELECT phase_type_id, name FROM phase_type_lu'
1515

1616
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'
1717
const QUERY_DROP_CHALLENGE_PHASE = 'DELETE FROM project_phase WHERE project_id = ? AND project_phase_id = ?'
18-
const QUERY_INSERT_CHALLENGE_PHASE = 'INSERT INTO project_phase (project_id, phase_type_id, phase_status_id, fixed_start_time, scheduled_start_time, scheduled_end_time, actual_start_time, actual_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT, ?, CURRENT)'
18+
const QUERY_INSERT_CHALLENGE_PHASE = 'INSERT INTO project_phase (project_phase_id, project_id, phase_type_id, phase_status_id, fixed_start_time, scheduled_start_time, scheduled_end_time, actual_start_time, actual_end_time, duration, create_user, create_date, modify_user, modify_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT, ?, CURRENT)'
1919
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'
2020

2121
const QUERY_DROP_CHALLENGE_PHASE_CRITERIA = 'DELETE FROM phase_criteria WHERE project_phase_id = ?'
@@ -128,6 +128,7 @@ async function createPhase (challengeLegacyId, phaseTypeId, statusTypeId, schedu
128128
await connection.beginTransactionAsync()
129129
const query = await prepare(connection, QUERY_INSERT_CHALLENGE_PHASE)
130130
logger.debug(`Query data: ${JSON.stringify([
131+
nextId,
131132
challengeLegacyId,
132133
phaseTypeId,
133134
statusTypeId,
@@ -141,6 +142,7 @@ async function createPhase (challengeLegacyId, phaseTypeId, statusTypeId, schedu
141142
createdBy
142143
])}`)
143144
result = await query.executeAsync([
145+
nextId,
144146
challengeLegacyId,
145147
phaseTypeId,
146148
statusTypeId,

0 commit comments

Comments
 (0)