add dateCreated to all tasks; add empty challenge object to tasks that don't have one (#7386)

This commit is contained in:
Alys
2016-05-21 09:20:11 +10:00
parent d3ecdae25c
commit 5c885c77a0

View File

@@ -134,6 +134,8 @@ TaskSchema.methods.toJSONV2 = function toJSONV2 () {
toJSON.id = toJSON._id;
}
if (!toJSON.challenge) toJSON.challenge = {};
let v3Tags = this.tags;
toJSON.tags = {};
@@ -141,6 +143,8 @@ TaskSchema.methods.toJSONV2 = function toJSONV2 () {
toJSON.tags[tag] = true;
});
toJSON.dateCreated = this.createdAt;
return toJSON;
};