@@ -30,8 +30,8 @@ async function recreatePhases (legacyId, v5Phases, createdBy) {
30
30
logger . debug ( 'Creating phases that exist on v5 and not on legacy...' )
31
31
for ( const phase of v5Phases ) {
32
32
const phaseLegacyId = _ . get ( _ . find ( phaseTypes , pt => pt . name === phase . name ) , 'phase_type_id' )
33
- logger . debug ( `Phase ${ phase . name } has legacy phase type id ${ phaseLegacyId } ` )
34
33
const existingLegacyPhase = _ . find ( phasesFromIFx , p => p . phase_type_id === phaseLegacyId )
34
+ logger . debug ( `Phase ${ phase . name } has legacy phase type id ${ phaseLegacyId } - Existing Phase ${ JSON . stringify ( existingLegacyPhase ) } ` )
35
35
if ( ! existingLegacyPhase && phaseLegacyId ) {
36
36
const statusTypeId = phase . isOpen
37
37
? constants . PhaseStatusTypes . Open
@@ -67,7 +67,6 @@ async function recreatePhases (legacyId, v5Phases, createdBy) {
67
67
/**
68
68
* Sync the information from the v5 phases into legacy
69
69
* @param {Number } legacyId the legacy challenge ID
70
- * @param {Array } v4Phases the v4 phases
71
70
* @param {Array } v5Phases the v5 phases
72
71
*/
73
72
async function syncChallengePhases ( legacyId , v5Phases ) {
@@ -78,10 +77,10 @@ async function syncChallengePhases (legacyId, v5Phases) {
78
77
for ( const phase of phasesFromIFx ) {
79
78
const phaseName = _ . get ( _ . find ( phaseTypes , pt => pt . phase_type_id === phase . phase_type_id ) , 'name' )
80
79
const v5Equivalent = _ . find ( v5Phases , p => p . name === phaseName )
81
- logger . info ( `Phase name : ${ phaseName } , v5 Equiv: ${ JSON . stringify ( v5Equivalent ) } ` )
80
+ logger . info ( `v4 Phase : ${ JSON . stringify ( phase ) } , v5 Equiv: ${ JSON . stringify ( v5Equivalent ) } ` )
82
81
if ( v5Equivalent ) {
83
82
// Compare duration and status
84
- if ( v5Equivalent . duration * 1000 !== phase . duration ) {
83
+ if ( v5Equivalent . duration * 1000 !== phase . duration * 1 ) {
85
84
// ||
86
85
// (v5Equivalent.isOpen && _.toInteger(phase.phase_status_id) === constants.PhaseStatusTypes.Closed) ||
87
86
// (!v5Equivalent.isOpen && _.toInteger(phase.phase_status_id) === constants.PhaseStatusTypes.Open)) {
0 commit comments