mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fixed misc bugs
This commit is contained in:
parent
ae23679a26
commit
fc4568a100
1 changed files with 5 additions and 7 deletions
|
@ -10,7 +10,6 @@ log = require 'winston'
|
|||
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
|
||||
lockManager = require '../commons/LockManager'
|
||||
#TODO: Ask Nick about email unsubscriptions
|
||||
|
||||
module.exports.setup = (app) ->
|
||||
app.all config.mail.mailchimpWebhook, handleMailchimpWebHook
|
||||
|
@ -84,7 +83,6 @@ findAllCandidatesWithinTimeRange = (cb) ->
|
|||
|
||||
candidateFilter = (candidate, sentEmailFilterCallback) ->
|
||||
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
|
||||
findParameters =
|
||||
"user": candidate._id
|
||||
|
@ -138,7 +136,7 @@ internalCandidateUpdateTask = ->
|
|||
lockDurationMs = 2 * 60 * 1000
|
||||
lockManager.setLock mailTaskName, lockDurationMs, (err) ->
|
||||
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
|
||||
log.error "There was an error sending the internal candidate update reminder.: #{err}"
|
||||
else
|
||||
|
@ -166,7 +164,7 @@ findNonApprovedCandidatesWhoUpdatedJobProfileToday = (cb) ->
|
|||
findParameters =
|
||||
"jobProfile.updated":
|
||||
$lte: @currentTime.toISOString()
|
||||
gt: @beginningOfUTCDay.toISOString()
|
||||
$gt: @beginningOfUTCDay.toISOString()
|
||||
"jobProfileApproved": false
|
||||
User.find(findParameters).select("_id jobProfile.name jobProfile.updated").lean().exec cb
|
||||
|
||||
|
@ -209,8 +207,8 @@ employerNewCandidatesAvailableTask = ->
|
|||
mailTaskName = "employerNewCandidatesAvailableTask"
|
||||
lockDurationMs = 2 * 60 * 1000
|
||||
lockManager.setLock mailTaskName, lockDurationMs, (err) ->
|
||||
if err? then return log.error "There was an error getting a task lock!"
|
||||
emailEmployerNewCandidatesAvailable.apply {"mailTaskName":mailTaskName}, (err) ->
|
||||
if err? then return log.error "There was an error getting a task lock!: #{err}"
|
||||
emailEmployerNewCandidatesAvailable.call {"mailTaskName":mailTaskName}, (err) ->
|
||||
if err
|
||||
log.error "There was an error completing the new candidates available task: #{err}"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue