habitrpg-shared: *almost* working wth new scoring (https://github.com/HabitRPG/habitrpg-shared/commit/c0cf9780fe8e17211d4749b9c3eb2a0fd389db64) - need to fix for cron, API, and other misc bugs

This commit is contained in:
Tyler Renelle
2013-05-19 23:48:51 +01:00
parent 6a36f4bd1d
commit 0b445df909
9 changed files with 46 additions and 112 deletions
+4 -3
View File
@@ -1,9 +1,9 @@
express = require 'express'
router = new express.Router()
scoring = require '../app/scoring'
_ = require 'underscore'
{ tnl } = require '../app/algos'
algos = require 'habitrpg-shared/script/algos'
{ tnl } = algos
validator = require 'derby-auth/node_modules/validator'
check = validator.check
sanitize = validator.sanitize
@@ -255,7 +255,8 @@ scoreTask = (req, res, next) ->
model.refList "_#{type}List", "_user.tasks", "_user.#{type}Ids"
model.at("_#{type}List").push task
delta = scoring.score(model, taskId, direction)
#FIXME
delta = algos.score(user.get(), taskId, direction)
result = model.get '_user.stats'
result.delta = delta
res.json result