trying some fixes for server crashing

This commit is contained in:
Tyler Renelle
2012-10-24 17:24:35 -04:00
parent bc460e5ecd
commit 9eb85a2782
4 changed files with 20 additions and 3 deletions

View File

@@ -175,6 +175,16 @@ score = function(taskId, direction, options) {
times: 1
};
}
if (_.isEmpty(model.get('_user'))) {
console.log({
taskId: taskId,
direction: direction,
options: options,
user: model.get('_user'),
error: 'non-user attempted to score'
});
return 0;
}
taskPath = "_user.tasks." + taskId;
_ref = [model.at(taskPath), model.get(taskPath)], task = _ref[0], taskObj = _ref[1];
type = taskObj.type, value = taskObj.value;