@@ -72,7 +72,7 @@ const migrationFunction = {
72
72
updated : null , // pull from phase info
73
73
updatedBy : 'applications' ,
74
74
timelineTemplateId : null ,
75
- phases : [ ] , // TODO :: process phases
75
+ phases : [ ] ,
76
76
terms : [ ] , // leave empty
77
77
startDate : null , // pull from phase info
78
78
numOfSubmissions : _ . toNumber ( c . numberOfSubmissions ) ,
@@ -89,19 +89,6 @@ const migrationFunction = {
89
89
newChallenge . created = challengeStartDate
90
90
newChallenge . updated = challengeEndDate
91
91
92
- const winners = _ . map ( c . winners , w => {
93
- return {
94
- handle : w . submitter
95
- // placement: w.rank // TODO :: missing placement?
96
- // TODO :: missing points as an object property
97
- }
98
- } )
99
- newChallenge . winners = winners
100
-
101
- // const savedChallenge = await challengeService.save(newChallenge)
102
- // logger.debug(`Challenge: ${JSON.stringify(newChallenge)}`)
103
- const savedChallenge = { id : uuid ( ) }
104
-
105
92
let handlesToLookup = [ ]
106
93
for ( const registrant of c . registrants ) {
107
94
// build cache
@@ -115,7 +102,18 @@ const migrationFunction = {
115
102
}
116
103
await cacheHandles ( handlesToLookup )
117
104
118
- logger . debug ( `Final Cache: ${ JSON . stringify ( memberHandleCache ) } ` )
105
+ const winners = _ . map ( c . winners , w => {
106
+ return {
107
+ handle : w . submitter
108
+ // placement: w.rank // TODO :: missing placement?
109
+ // TODO :: missing points as an object property
110
+ }
111
+ } )
112
+ newChallenge . winners = winners
113
+
114
+ // const savedChallenge = await challengeService.save(newChallenge)
115
+ const savedChallenge = { id : uuid ( ) }
116
+ logger . debug ( `Challenge: ${ JSON . stringify ( newChallenge ) } ` )
119
117
120
118
for ( const registrant of c . registrants ) {
121
119
const memberId = await getMemberIdFromCache ( registrant . handle )
@@ -131,7 +129,7 @@ const migrationFunction = {
131
129
roleId : config . SUBMITTER_ROLE_ID
132
130
}
133
131
// await resourceService.save(newResource)
134
- logger . debug ( `Resource: ${ JSON . stringify ( newResource ) } ` )
132
+ // logger.debug(`Resource: ${JSON.stringify(newResource)}`)
135
133
}
136
134
return
137
135
}
@@ -177,7 +175,7 @@ function convertPhases (v4PhasesArray) {
177
175
const phases = _ . map ( v4PhasesArray , phase => {
178
176
const start = moment ( phase . actualStartTime )
179
177
const end = moment ( phase . actualEndTime )
180
- const v5duration = start . diff ( end , 'seconds' )
178
+ const v5duration = end . diff ( start , 'seconds' )
181
179
if ( challengeStartDate === null ) {
182
180
challengeStartDate = moment ( phase . actualStartTime ) . utc ( ) . format ( )
183
181
}
0 commit comments