mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 10:06:08 -05:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
6c7576a741
2 changed files with 18 additions and 1 deletions
|
@ -146,6 +146,18 @@ _.extend LevelSessionSchema.properties,
|
||||||
numberOfLosses:
|
numberOfLosses:
|
||||||
type: 'number'
|
type: 'number'
|
||||||
default: 0
|
default: 0
|
||||||
|
|
||||||
|
scoreHistory:
|
||||||
|
type: 'array'
|
||||||
|
title: 'Score History'
|
||||||
|
description: 'A list of objects representing the score history of a session'
|
||||||
|
items:
|
||||||
|
title: 'Score History Point'
|
||||||
|
description: 'An array with the format [unix timestamp, totalScore]'
|
||||||
|
type: 'array'
|
||||||
|
items:
|
||||||
|
type: 'number'
|
||||||
|
|
||||||
|
|
||||||
matches:
|
matches:
|
||||||
type: 'array'
|
type: 'array'
|
||||||
|
|
|
@ -443,10 +443,15 @@ updateScoreInSession = (scoreObject,callback) ->
|
||||||
if err? then return callback err, null
|
if err? then return callback err, null
|
||||||
|
|
||||||
session = session.toObject()
|
session = session.toObject()
|
||||||
|
newTotalScore = scoreObject.meanStrength - 1.8 * scoreObject.standardDeviation
|
||||||
|
scoreHistoryAddition = [Date.now(), newTotalScore]
|
||||||
updateObject =
|
updateObject =
|
||||||
meanStrength: scoreObject.meanStrength
|
meanStrength: scoreObject.meanStrength
|
||||||
standardDeviation: scoreObject.standardDeviation
|
standardDeviation: scoreObject.standardDeviation
|
||||||
totalScore: scoreObject.meanStrength - 1.8 * scoreObject.standardDeviation
|
totalScore: newTotalScore
|
||||||
|
$push:
|
||||||
|
scoreHistory: scoreHistoryAddition
|
||||||
|
|
||||||
LevelSession.update {"_id": scoreObject.id}, updateObject, callback
|
LevelSession.update {"_id": scoreObject.id}, updateObject, callback
|
||||||
log.info "New total score for session #{scoreObject.id} is #{updateObject.totalScore}"
|
log.info "New total score for session #{scoreObject.id} is #{updateObject.totalScore}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue