mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 19:06:59 -05:00
Update campaign editor analytics
Level view recent sessions is latest - 10 minutes.
This commit is contained in:
parent
583cb03b89
commit
372ac20a67
2 changed files with 5 additions and 3 deletions
|
@ -58,8 +58,7 @@ class AnalyticsLogEventHandler extends Handler
|
|||
|
||||
# Build query
|
||||
queryParams = {$and: [
|
||||
{$or: [{"event" : 'Started Level'}, {"event" : 'Saw Victory'}]}#,
|
||||
# {$or: [{"properties.level": "Endangered Burl"}, {"properties.levelID": "endangered-burl"}, {"properties.level": "Dungeons of Kithgard"}, {"properties.levelID": "dungeons-of-kithgard"}]}
|
||||
{$or: [{"event" : 'Started Level'}, {"event" : 'Saw Victory'}]}
|
||||
]}
|
||||
queryParams["$and"].push created: {$gte: new Date(startDay + "T00:00:00.000Z")} if startDay?
|
||||
queryParams["$and"].push created: {$lt: new Date(endDay + "T00:00:00.000Z")} if endDay?
|
||||
|
|
|
@ -38,7 +38,10 @@ class LevelSessionHandler extends Handler
|
|||
|
||||
return @sendSuccess res, [] unless levelSlug?
|
||||
|
||||
query = @modelClass.find({"levelID": levelSlug}).sort({changed: -1}).limit(limit)
|
||||
today = new Date()
|
||||
today.setUTCMinutes(today.getUTCMinutes() - 10)
|
||||
queryParams = {$and: [{"changed": {"$lt": today}}, {"levelID": levelSlug}]}
|
||||
query = @modelClass.find(queryParams).sort({changed: -1}).limit(limit)
|
||||
query.exec (err, documents) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
@sendSuccess res, documents
|
||||
|
|
Loading…
Reference in a new issue