mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-10 20:15:14 -04:00
Use level instead of levelID for getHistogramData to hit the index we already have
This commit is contained in:
parent
cea412c0a9
commit
acdfe7c1c4
1 changed files with 4 additions and 3 deletions
|
@ -182,10 +182,11 @@ LevelHandler = class LevelHandler extends Handler
|
||||||
query.exec (err, results) =>
|
query.exec (err, results) =>
|
||||||
if err then @sendDatabaseError(res, err) else @sendSuccess res, results
|
if err then @sendDatabaseError(res, err) else @sendSuccess res, results
|
||||||
|
|
||||||
getHistogramData: (req, res, slug) ->
|
getHistogramData: (req, res, id) ->
|
||||||
match = levelID: slug, submitted: true, team: req.query.team
|
match = @makeLeaderboardQueryParameters req, id
|
||||||
match['leagues.leagueID'] = league if league = req.query['leagues.leagueID']
|
delete match.totalScore
|
||||||
project = totalScore: 1, _id: 0
|
project = totalScore: 1, _id: 0
|
||||||
|
league = req.query['leagues.leagueID']
|
||||||
project['leagues.leagueID'] = project['leagues.stats.totalScore'] = 1 if league
|
project['leagues.leagueID'] = project['leagues.stats.totalScore'] = 1 if league
|
||||||
aggregate = Session.aggregate [
|
aggregate = Session.aggregate [
|
||||||
{$match: match}
|
{$match: match}
|
||||||
|
|
Loading…
Add table
Reference in a new issue