mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-22 02:45:29 -04:00
Optimize recent subs api
This commit is contained in:
parent
1ac249565a
commit
afc3689dcc
1 changed files with 3 additions and 1 deletions
|
@ -101,7 +101,9 @@ class SubscriptionHandler extends Handler
|
|||
return @sendDatabaseError(res, err)
|
||||
log.debug 'Analytics established connection to analytics server.'
|
||||
userEventMap = {}
|
||||
db.collection('log').find({user: {$in: subscriberUserIDs}}).sort({_id: -1}).each (err, doc) =>
|
||||
events = ['Finished subscription purchase', 'Show subscription modal']
|
||||
query = {$and: [{user: {$in: subscriberUserIDs}}, {event: {$in: events}}]}
|
||||
db.collection('log').find(query).sort({_id: -1}).each (err, doc) =>
|
||||
if err
|
||||
db.close()
|
||||
return @sendDatabaseError(res, err)
|
||||
|
|
Loading…
Reference in a new issue