Patch Earned Achievements more generally.

This commit is contained in:
Rob 2016-07-25 16:18:31 -07:00
parent d292e180d2
commit 782aacf35e
2 changed files with 3 additions and 3 deletions

View file

@ -66,4 +66,5 @@ module.exports.modules = modules = # by collection name
'users': 'User'
mongoose.modelNameByCollection = (collection) ->
return require('../models/LevelSession') if collection is 'level.session'
mongoose.model modules[collection] if collection of modules

View file

@ -51,9 +51,8 @@ class EarnedAchievementHandler extends Handler
collection = req.body.collection
if collection isnt 'level.sessions'
return @sendBadInputError(res, 'Only doing level session achievements for now.')
#model = mongoose.modelNameByCollection(collection)
else
model = LevelSession
model = mongoose.modelNameByCollection(collection)
async.parallel({
achievement: (callback) ->