challenges: but provide default notes

This commit is contained in:
Tyler Renelle 2014-01-03 14:34:47 -07:00
parent 9a6f0c0339
commit d9779d8e51

View file

@ -102,6 +102,7 @@ ChallengeSchema.methods.syncToUser = function(user, cb) {
_.each(self.tasks, function(task){
var list = user[task.type+'s'];
var userTask = user.tasks[task.id] || (list.push(syncableAttrs(task)), list[list.length-1]);
if (!userTask.notes) userTask.notes = task.notes; // don't override the notes, but provide it if not provided
userTask.challenge = {id:self._id};
userTask.tags = userTask.tags || {};
userTask.tags[self._id] = true;