[#1672] assign tasks.id = tasks._id for challenges, fixes html ids & for lables

This commit is contained in:
Tyler Renelle
2013-11-01 09:48:22 -07:00
parent cc5126f09b
commit 37027ac874
3 changed files with 15 additions and 7 deletions

View File

@@ -39,6 +39,11 @@ ChallengeSchema.methods.toJSON = function(){
var doc = this.toObject();
doc.memberCount = doc.members ? _.size(doc.members) : doc.memberCount; // @see pre('save') comment above
doc._isMember = this._isMember;
_.each(['habits','dailys','todos','rewards'], function(type){
_.each(doc[type],function(task){
task.id = task._id;
})
})
return doc;
}