Moved if statement to assign task completion before saving task to user

This commit is contained in:
TheHollidayInn
2015-04-07 19:40:54 -05:00
parent 75fdf84533
commit c2614c0447
+3 -1
View File
@@ -99,9 +99,11 @@ api.score = function(req, res, next) {
text: req.body && req.body.text,
notes: (req.body && req.body.notes) || "This task was created by a third-party service. Feel free to edit, it won't harm the connection to that service. Additionally, multiple services may piggy-back off this task."
};
task = user.ops.addTask({body:task});
if (task.type === 'daily' || task.type === 'todo')
task.completed = direction === 'up';
task = user.ops.addTask({body:task});
}
var delta = user.ops.score({params:{id:task.id, direction:direction}, language: req.language});