From bf7172b09d02be33b146b7c03a8617b6ec63d072 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 13 Sep 2022 18:49:18 +1000 Subject: [PATCH 1/3] Revert "Test for phase syncing for multi-round challenges" This reverts commit 0959e0b38fb92d9125a1ce744651dabda11b9177. --- src/constants.js | 7 ------- src/services/ProcessorService.js | 5 ----- 2 files changed, 12 deletions(-) diff --git a/src/constants.js b/src/constants.js index 422afb0..0e848a1 100644 --- a/src/constants.js +++ b/src/constants.js @@ -71,12 +71,6 @@ const PhaseStatusTypes = { Closed: 3 } -const CheckpointPhaseTypes = { - Submission: 'Checkpoint Submission', - Screening: 'Checkpoint Screening', - Review: 'Checkpoint Review', -} - const prizeTypesIds = { Contest: 15, Checkpoint: 14 @@ -172,7 +166,6 @@ module.exports = { createChallengeStatusesMap, challengeStatuses, PhaseStatusTypes, - CheckpointPhaseTypes, prizeTypesIds, supportedMetadata, scorecardQuestionMapping diff --git a/src/services/ProcessorService.js b/src/services/ProcessorService.js index 1051d22..8a75f06 100644 --- a/src/services/ProcessorService.js +++ b/src/services/ProcessorService.js @@ -658,11 +658,6 @@ async function processMessage (message) { if (_.get(message, 'payload.legacy.selfService')) { await disableTimelineNotifications(legacyId, createdByUserId) // disable } - } else { - const v5PhaseType = _.find(message.payload.phases, p => p.name === constants.CheckpointPhaseTypes.Submission) - if (v5PhaseType) { - await recreatePhases(legacyId, message.payload.phases, updatedByUserId) - } } logger.debug('Result from parsePayload:') From 07e9f1454b6eea827037f3fd3ffa521fd625d5b5 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 28 Sep 2022 16:09:09 +1000 Subject: [PATCH 2/3] Test fix for failing multi-round sync issue --- src/services/timelineService.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/services/timelineService.js b/src/services/timelineService.js index 81a2d0b..e5ffec3 100644 --- a/src/services/timelineService.js +++ b/src/services/timelineService.js @@ -15,7 +15,7 @@ const QUERY_GET_PHASE_TYPES = 'SELECT phase_type_id, name FROM phase_type_lu' 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' const QUERY_DROP_CHALLENGE_PHASE = 'DELETE FROM project_phase WHERE project_id = ? AND project_phase_id = ?' -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)' +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)' 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' const QUERY_DROP_CHALLENGE_PHASE_CRITERIA = 'DELETE FROM phase_criteria WHERE project_phase_id = ?' @@ -128,7 +128,6 @@ async function createPhase (challengeLegacyId, phaseTypeId, statusTypeId, schedu await connection.beginTransactionAsync() const query = await prepare(connection, QUERY_INSERT_CHALLENGE_PHASE) logger.debug(`Query data: ${JSON.stringify([ - nextId, challengeLegacyId, phaseTypeId, statusTypeId, @@ -142,7 +141,6 @@ async function createPhase (challengeLegacyId, phaseTypeId, statusTypeId, schedu createdBy ])}`) result = await query.executeAsync([ - nextId, challengeLegacyId, phaseTypeId, statusTypeId, From 25bfb2bd2c6059aad09dd91aad284798730bf4cf Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 28 Sep 2022 16:27:31 +1000 Subject: [PATCH 3/3] Use the *correct* sequence generator when adding new project phases. --- src/services/timelineService.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/timelineService.js b/src/services/timelineService.js index e5ffec3..04ce9bb 100644 --- a/src/services/timelineService.js +++ b/src/services/timelineService.js @@ -9,13 +9,13 @@ const momentTZ = require('moment-timezone') const IDGenerator = require('../common/idGenerator') const helper = require('../common/helper') -const phaseIdGen = new IDGenerator('prize_id_seq') +const phaseIdGen = new IDGenerator('project_phase_id_seq') const QUERY_GET_PHASE_TYPES = 'SELECT phase_type_id, name FROM phase_type_lu' 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' const QUERY_DROP_CHALLENGE_PHASE = 'DELETE FROM project_phase WHERE project_id = ? AND project_phase_id = ?' -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)' +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)' 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' 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 await connection.beginTransactionAsync() const query = await prepare(connection, QUERY_INSERT_CHALLENGE_PHASE) logger.debug(`Query data: ${JSON.stringify([ + nextId, challengeLegacyId, phaseTypeId, statusTypeId, @@ -141,6 +142,7 @@ async function createPhase (challengeLegacyId, phaseTypeId, statusTypeId, schedu createdBy ])}`) result = await query.executeAsync([ + nextId, challengeLegacyId, phaseTypeId, statusTypeId,