mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
bug fix on saving chal
This commit is contained in:
@@ -47,7 +47,7 @@ ChallengeSchema.methods.toJSON = function(){
|
||||
// --------------
|
||||
|
||||
function syncableAttrs(task) {
|
||||
var t = task.toObject(); // lodash doesn't seem to like _.omit on EmbeddedDocument
|
||||
var t = (task.toObject) ? task.toObject() : task; // lodash doesn't seem to like _.omit on EmbeddedDocument
|
||||
// only sync/compare important attrs
|
||||
var omitAttrs = 'history tags completed streak'.split(' ');
|
||||
if (t.type != 'reward') omitAttrs.push('value');
|
||||
@@ -67,7 +67,7 @@ function comparableData(obj) {
|
||||
.toString(); // for comparing arrays easily
|
||||
}
|
||||
|
||||
ChallengeSchema.isOutdated = function(newData) {
|
||||
ChallengeSchema.methods.isOutdated = function(newData) {
|
||||
return comparableData(this) !== comparableData(newData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user