From 4f0805ce1e36d562b6d11a61e24ab3178e371adf Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 13 Mar 2014 18:50:52 -0700 Subject: [PATCH] I changed the semantics of the i18n fallback to not hit 'text' for other properties, so updated a test. --- server/routes/mail.coffee | 10 ++++++---- test/app/lib/utils.spec.coffee | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/routes/mail.coffee b/server/routes/mail.coffee index 07f7169fd..69decd276 100644 --- a/server/routes/mail.coffee +++ b/server/routes/mail.coffee @@ -16,7 +16,7 @@ sendwithus = require '../sendwithus' module.exports.setup = (app) -> app.all config.mail.mailchimpWebhook, handleMailchimpWebHook app.get '/mail/cron/ladder-update', handleLadderUpdate - + getAllLadderScores = (next) -> query = Level.find({type: 'ladder'}) .select('levelID') @@ -28,6 +28,8 @@ getAllLadderScores = (next) -> for level in levels for team in ['humans', 'ogres'] 'I ... am not doing this.' + # Query to get sessions to make histogram + # db.level.sessions.find({"submitted":true,"levelID":"brawlwood",team:"ogres"},{"_id":0,"totalScore":1}) isRequestFromDesignatedCronHandler = (req, res) -> if req.ip isnt config.mail.cronHandlerPublicIP and req.ip isnt config.mail.cronHandlerPrivateIP @@ -36,13 +38,13 @@ isRequestFromDesignatedCronHandler = (req, res) -> res.end() return false return true - - + + handleLadderUpdate = (req, res) -> log.info("Going to see about sending ladder update emails.") requestIsFromDesignatedCronHandler = isRequestFromDesignatedCronHandler req, res unless requestIsFromDesignatedCronHandler then return - + res.send('Great work, Captain Cron! I can take it from here.') res.end() # TODO: somehow fetch the histograms diff --git a/test/app/lib/utils.spec.coffee b/test/app/lib/utils.spec.coffee index 7852ddf5e..925bc8e54 100644 --- a/test/app/lib/utils.spec.coffee +++ b/test/app/lib/utils.spec.coffee @@ -40,7 +40,7 @@ describe 'utils library', -> expect(util.i18n(this.fixture1, 'text', 'en')).toEqual(this.fixture1.text) expect(util.i18n(this.fixture1, 'blurb', 'en')).toEqual(this.fixture1.blurb) delete this.fixture1.blurb - expect(util.i18n(this.fixture1, 'blurb', 'en')).toEqual(this.fixture1.text) + expect(util.i18n(this.fixture1, 'blurb', 'en')).toEqual(null) it 'i18n can fall forward if a general language is not found', -> expect(util.i18n(this.fixture1, 'text', 'pt')).toEqual(this.fixture1.i18n['pt-BR'].text)