mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-24 19:59:53 -04:00
Fixed misc bugs
This commit is contained in:
parent
ae23679a26
commit
fc4568a100
1 changed files with 5 additions and 7 deletions
|
@ -10,8 +10,7 @@ log = require 'winston'
|
||||||
sendwithus = require '../sendwithus'
|
sendwithus = require '../sendwithus'
|
||||||
if config.isProduction or config.redis.host isnt "localhost" #TODO: Ask Nick and Scott to change their environment variables and change the deploy ones
|
if config.isProduction or config.redis.host isnt "localhost" #TODO: Ask Nick and Scott to change their environment variables and change the deploy ones
|
||||||
lockManager = require '../commons/LockManager'
|
lockManager = require '../commons/LockManager'
|
||||||
#TODO: Ask Nick about email unsubscriptions
|
|
||||||
|
|
||||||
module.exports.setup = (app) ->
|
module.exports.setup = (app) ->
|
||||||
app.all config.mail.mailchimpWebhook, handleMailchimpWebHook
|
app.all config.mail.mailchimpWebhook, handleMailchimpWebHook
|
||||||
app.get '/mail/cron/ladder-update', handleLadderUpdate
|
app.get '/mail/cron/ladder-update', handleLadderUpdate
|
||||||
|
@ -84,7 +83,6 @@ findAllCandidatesWithinTimeRange = (cb) ->
|
||||||
|
|
||||||
candidateFilter = (candidate, sentEmailFilterCallback) ->
|
candidateFilter = (candidate, sentEmailFilterCallback) ->
|
||||||
if candidate.emails?.anyNotes?.enabled is false or candidate.emails?.recruitNotes?.enabled is false
|
if candidate.emails?.anyNotes?.enabled is false or candidate.emails?.recruitNotes?.enabled is false
|
||||||
log.info "Candidate #{candidate.jobProfile.name} opted out of emails, not sending to them."
|
|
||||||
return sentEmailFilterCallback true
|
return sentEmailFilterCallback true
|
||||||
findParameters =
|
findParameters =
|
||||||
"user": candidate._id
|
"user": candidate._id
|
||||||
|
@ -138,7 +136,7 @@ internalCandidateUpdateTask = ->
|
||||||
lockDurationMs = 2 * 60 * 1000
|
lockDurationMs = 2 * 60 * 1000
|
||||||
lockManager.setLock mailTaskName, lockDurationMs, (err) ->
|
lockManager.setLock mailTaskName, lockDurationMs, (err) ->
|
||||||
if err? then return log.error "Error getting a distributed lock for task #{mailTaskName}!"
|
if err? then return log.error "Error getting a distributed lock for task #{mailTaskName}!"
|
||||||
emailInternalCandidateUpdateReminder.apply {"mailTaskName":mailTaskName}, (err) ->
|
emailInternalCandidateUpdateReminder.call {"mailTaskName":mailTaskName}, (err) ->
|
||||||
if err
|
if err
|
||||||
log.error "There was an error sending the internal candidate update reminder.: #{err}"
|
log.error "There was an error sending the internal candidate update reminder.: #{err}"
|
||||||
else
|
else
|
||||||
|
@ -166,7 +164,7 @@ findNonApprovedCandidatesWhoUpdatedJobProfileToday = (cb) ->
|
||||||
findParameters =
|
findParameters =
|
||||||
"jobProfile.updated":
|
"jobProfile.updated":
|
||||||
$lte: @currentTime.toISOString()
|
$lte: @currentTime.toISOString()
|
||||||
gt: @beginningOfUTCDay.toISOString()
|
$gt: @beginningOfUTCDay.toISOString()
|
||||||
"jobProfileApproved": false
|
"jobProfileApproved": false
|
||||||
User.find(findParameters).select("_id jobProfile.name jobProfile.updated").lean().exec cb
|
User.find(findParameters).select("_id jobProfile.name jobProfile.updated").lean().exec cb
|
||||||
|
|
||||||
|
@ -209,8 +207,8 @@ employerNewCandidatesAvailableTask = ->
|
||||||
mailTaskName = "employerNewCandidatesAvailableTask"
|
mailTaskName = "employerNewCandidatesAvailableTask"
|
||||||
lockDurationMs = 2 * 60 * 1000
|
lockDurationMs = 2 * 60 * 1000
|
||||||
lockManager.setLock mailTaskName, lockDurationMs, (err) ->
|
lockManager.setLock mailTaskName, lockDurationMs, (err) ->
|
||||||
if err? then return log.error "There was an error getting a task lock!"
|
if err? then return log.error "There was an error getting a task lock!: #{err}"
|
||||||
emailEmployerNewCandidatesAvailable.apply {"mailTaskName":mailTaskName}, (err) ->
|
emailEmployerNewCandidatesAvailable.call {"mailTaskName":mailTaskName}, (err) ->
|
||||||
if err
|
if err
|
||||||
log.error "There was an error completing the new candidates available task: #{err}"
|
log.error "There was an error completing the new candidates available task: #{err}"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue