mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
complete preening and enable for challenges too
This commit is contained in:
@@ -135,8 +135,14 @@ api.score = function(req, res, next) {
|
||||
}
|
||||
|
||||
t.value += delta;
|
||||
if (t.type == 'habit' || t.type == 'daily')
|
||||
if (t.type == 'habit' || t.type == 'daily') {
|
||||
t.history.push({value: t.value, date: +new Date});
|
||||
if (t.history.length > 365) {
|
||||
var tIndex = chal[`${t.type}`].indexOf(t);
|
||||
t.history = shared.preenHistory(t.history, true); // true means the challenge will retain as much entries as a subscribed user
|
||||
chal.markModified(`${t.type}s.${tIndex}.history`); // Setting habits/dailys as modified because we don't know the index of the task
|
||||
}
|
||||
}
|
||||
chal.save();
|
||||
clearMemory();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user