challenges: only push history for dailies / habits

This commit is contained in:
Tyler Renelle
2013-11-22 23:22:24 -07:00
parent 306e235ef7
commit 123c515cbb
+3 -1
View File
@@ -287,7 +287,9 @@ UserSchema.methods.syncScoreToChallenge = function(task, delta){
var t = chal.tasks[task.id];
if (!t) return chal.syncToUser(self); // this task was removed from the challenge, notify user
t.value += delta;
t.history.push({value: t.value, date: +new Date});
if (t.type == 'habit' || t.type == 'daily') {
t.history.push({value: t.value, date: +new Date});
}
chal.save();
});
}