Even less emphasis on recent games, for . But we might need something different due to the time-clustered nature of submissions leading to an uneven distribution.

This commit is contained in:
Nick Winter 2015-03-01 07:57:21 -08:00
parent 26c5c17eab
commit 2767fbc7aa

View file

@ -115,7 +115,7 @@ findRandomSession = (queryParams, callback) ->
return callback err, null unless startDate
now = new Date()
interval = now - startDate
cutoff = new Date now - Math.pow(Math.random(), 3) * interval
cutoff = new Date now - Math.pow(Math.random(), 2) * interval
queryParams.submitDate = $gte: startDate, $lt: cutoff
selection = 'team totalScore transpiledCode submittedCodeLanguage teamSpells levelID creatorName creator submitDate'
LevelSession.findOne(queryParams).sort(submitDate: -1).select(selection).lean().exec (err, session) ->