@@ -535,6 +535,11 @@ async function createResource (currentUser, resource) {
535535 console . log ( 'config template id' , config . get ( 'TOPCROWD_CHALLENGE_TEMPLATE_ID' ) )
536536 if ( config . get ( 'TOPCROWD_CHALLENGE_TEMPLATE_ID' ) !== timelineTemplateId ) {
537537 console . log ( 'sending email' )
538+ const submissionPhase = _ . find ( challenge . phases , phase => [ 'Submission' , 'Topgear Submission' ] . includes ( phase . name ) )
539+ const submissionEndTime = submissionPhase && submissionPhase . scheduledEndDate
540+ ? new Date ( submissionPhase . scheduledEndDate ) . toUTCString ( )
541+ : null
542+
538543 await helper . postEvent ( config . EMAIL_NOTIFICATIN_TOPIC , {
539544 from : config . REGISTRATION_EMAIL . EMAIL_FROM ,
540545 replyTo : config . REGISTRATION_EMAIL . EMAIL_FROM ,
@@ -543,7 +548,7 @@ async function createResource (currentUser, resource) {
543548 handle,
544549 challengeName : challenge . name ,
545550 forum : forumUrl ,
546- submissionEndTime : new Date ( _ . get ( _ . find ( challenge . phases , phase => phase . name === 'Submission' ) , 'scheduledEndDate' ) ) . toUTCString ( ) ,
551+ submissionEndTime,
547552 submitUrl : _ . replace ( config . REGISTRATION_EMAIL . SUBMIT_URL , ':id' , challengeId ) ,
548553 reviewAppUrl : config . REGISTRATION_EMAIL . REVIEW_APP_URL + challenge . id + '/challenge-details' ,
549554 helpUrl : config . REGISTRATION_EMAIL . HELP_URL ,
0 commit comments