Remove HoC extra 2 months trial enrollments

This commit is contained in:
Matt Lott 2016-01-07 15:45:46 -08:00
parent a10aec256f
commit 017dea696f
3 changed files with 3 additions and 24 deletions

View file

@ -31,9 +31,6 @@ block content
span.spl(data-i18n="teachers_survey.contact_2")
else
p(data-i18n="teachers_survey.description_1")
p
strong.spr Hour of Code Special!
span Complete the survey by December 31st and enroll all your students in the paid courses for 2 months.
p
span.spr(data-i18n="teachers_survey.description_1b")
a(href='/teachers', data-i18n="teachers_survey.description_2")

View file

@ -22,5 +22,5 @@ module.exports.templates =
plain_text_email: 'tem_85UvKDCCNPXsFckERTig6Y'
next_steps_email: 'tem_RDHhTG5inXQi8pthyqWr5D'
course_invite_email: 'tem_u6D2EFWYC5Ptk38bSykjsU'
teacher_free_trial: 'tem_sqdvLCZRwoDQc6jAf5RrQE'
teacher_free_trial: 'tem_R7d9Hpoba9SceQNiYSXBak'
teacher_free_trial_hoc: 'tem_4ZSY9wsA9Qwn4wBFmZgPdc'

View file

@ -21,32 +21,14 @@ TrialRequestSchema.pre 'save', (next) ->
prepaid.save (err) =>
if err
log.error "Trial request prepaid creation error: #{err}"
# Special HoC trial: Add 500 course headcount with end date
endDate = new Date()
endDate.setUTCMonth(endDate.getUTCMonth() + 2)
prepaid = new Prepaid
creator: @get('applicant')
type: 'course'
maxRedeemers: 500
properties:
endDate: endDate
trialRequestID: @get('_id')
prepaid.save (err) =>
if err
log.error "Trial request prepaid creation error: #{err}"
next()
next()
TrialRequestSchema.post 'save', (doc) ->
if doc.get('status') is 'approved'
endDate = new Date()
endDate.setUTCMonth(endDate.getUTCMonth() + 2)
emailParams =
recipient:
address: doc.get('properties')?.email
email_id: sendwithus.templates.teacher_free_trial_hoc
email_data:
endDate: endDate.toDateString()
email_id: sendwithus.templates.teacher_free_trial
sendwithus.api.send emailParams, (err, result) =>
log.error "sendwithus trial request approved error: #{err}, result: #{result}" if err