mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
do not delete completed todos that belongs to a challenge
This commit is contained in:
@@ -34,6 +34,7 @@ export default function cronMiddleware (req, res, next) {
|
||||
cron({user, tasksByType, now, daysMissed, analytics});
|
||||
|
||||
// Clean completed todos - 30 days for free users, 90 for subscribers
|
||||
// Do not delete challenges completed todos TODO unless the task is broken?
|
||||
Task.remove({
|
||||
userId: user._id,
|
||||
type: 'todo',
|
||||
@@ -41,6 +42,7 @@ export default function cronMiddleware (req, res, next) {
|
||||
dateCompleted: {
|
||||
$lt: moment(now).subtract(user.isSubscribed() ? 90 : 30, 'days'),
|
||||
},
|
||||
'challenge.id': {$exists: false},
|
||||
}).exec(); // TODO catch error or at least log it
|
||||
|
||||
let ranCron = user.isModified();
|
||||
|
||||
Reference in New Issue
Block a user