mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
some bugs which are a result of user not being tested as already dead.
using scoring.setUser() so we don't have to pass user all over the place, there's probably a better approach -- revisit
This commit is contained in:
@@ -7,16 +7,13 @@ module.exports = function(expressApp, root, derby) {
|
||||
expressApp.get('/:uid/up/:score?', function(req, res) {
|
||||
var model, score;
|
||||
score = parseInt(req.params.score) || 1;
|
||||
console.log({
|
||||
score: score
|
||||
});
|
||||
model = req.getModel();
|
||||
model.fetch("users." + req.params.uid, function(err, user) {
|
||||
if (err || !user.get()) {
|
||||
return;
|
||||
}
|
||||
scoring.setUser(user);
|
||||
return scoring.score({
|
||||
user: user,
|
||||
direction: 'up'
|
||||
});
|
||||
});
|
||||
@@ -25,16 +22,13 @@ module.exports = function(expressApp, root, derby) {
|
||||
expressApp.get('/:uid/down/:score?', function(req, res) {
|
||||
var model, score;
|
||||
score = parseInt(req.params.score) || 1;
|
||||
console.log({
|
||||
score: score
|
||||
});
|
||||
model = req.getModel();
|
||||
model.fetch("users." + req.params.uid, function(err, user) {
|
||||
if (err || !user.get()) {
|
||||
return;
|
||||
}
|
||||
scoring.setUser(user);
|
||||
return scoring.score({
|
||||
user: user,
|
||||
direction: 'down'
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user