mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Removed extraneous code
This commit is contained in:
parent
3ff66d7807
commit
02ccade43f
1 changed files with 1 additions and 13 deletions
|
@ -1,16 +1,12 @@
|
|||
mail = require '../commons/mail'
|
||||
User = require '../users/User'
|
||||
errors = require '../commons/errors'
|
||||
#request = require 'request'
|
||||
config = require '../../server_config'
|
||||
LevelSession = require '../levels/sessions/LevelSession'
|
||||
Level = require '../levels/Level'
|
||||
log = require 'winston'
|
||||
sendwithus = require '../sendwithus'
|
||||
|
||||
#badLog = (text) ->
|
||||
# console.log text
|
||||
# request.post 'http://requestb.in/1brdpaz1', { form: {log: text} }
|
||||
|
||||
module.exports.setup = (app) ->
|
||||
app.all config.mail.mailchimpWebhook, handleMailchimpWebHook
|
||||
|
@ -82,14 +78,10 @@ sendLadderUpdateEmail = (session, now, daysAgo) ->
|
|||
matches = _.filter session.matches, (match) -> match.date >= getTimeFromDaysAgo now, daysAgo
|
||||
defeats = _.filter matches, (match) -> match.metrics.rank is 1 and match.opponents[0].metrics.rank is 0
|
||||
victories = _.filter matches, (match) -> match.metrics.rank is 0 and match.opponents[0].metrics.rank is 1
|
||||
#ties = _.filter matches, (match) -> match.metrics.rank is 0 and match.opponents[0].metrics.rank is 0
|
||||
|
||||
defeat = _.last defeats
|
||||
victory = _.last victories
|
||||
|
||||
#log.info "#{user.name} had #{matches.length} matches from last #{daysAgo} days out of #{session.matches.length} total matches. #{defeats.length} defeats, #{victories.length} victories, and #{ties.length} ties."
|
||||
#matchInfos = ("\t#{match.date}\t#{match.date >= getTimeFromDaysAgo(now, daysAgo)}\t#{match.metrics.rank}\t#{match.opponents[0].metrics.rank}" for match in session.matches)
|
||||
#log.info "Matches:\n#{matchInfos.join('\n')}"
|
||||
|
||||
sendEmail = (defeatContext, victoryContext) ->
|
||||
# TODO: do something with the preferredLanguage?
|
||||
context =
|
||||
|
@ -161,7 +153,6 @@ getScoreHistoryGraphURL = (session, daysAgo) ->
|
|||
|
||||
handleMailchimpWebHook = (req, res) ->
|
||||
post = req.body
|
||||
#badLog("Got post data: #{JSON.stringify(post, null, '\t')}")
|
||||
|
||||
unless post.type in ['unsubscribe', 'profile']
|
||||
res.send 'Bad post type'
|
||||
|
@ -200,11 +191,8 @@ module.exports.handleProfileUpdate = handleProfileUpdate = (user, post) ->
|
|||
user.set 'mailChimp.email', post.data.email
|
||||
user.set 'mailChimp.euid', post.data.id
|
||||
|
||||
# badLog("Updating user object to: #{JSON.stringify(user.toObject(), null, '\t')}")
|
||||
|
||||
module.exports.handleUnsubscribe = handleUnsubscribe = (user) ->
|
||||
user.set 'emailSubscriptions', []
|
||||
for emailGroup in mail.NEWS_GROUPS
|
||||
user.setEmailSubscription emailGroup, false
|
||||
|
||||
# badLog("Unsubscribing user object to: #{JSON.stringify(user.toObject(), null, '\t')}")
|
||||
|
|
Loading…
Reference in a new issue