fix(cron): don't process group tasks during user cron

This commit is contained in:
SabreCat 2022-08-24 14:18:07 -05:00
parent bc8b1884b7
commit a5d9448af1

View file

@ -74,19 +74,10 @@ async function cronAsync (req, res) {
}
const tasks = await Tasks.Task.find({
$and: [
{
$or: [
{ userId: user._id },
{ userId: { $exists: false }, 'group.assignedUsers': user._id },
],
},
{
$or: [ // Exclude completed todos
{ type: 'todo', completed: false },
{ type: { $in: ['habit', 'daily', 'reward'] } },
],
},
userId: user._id,
$or: [ // Exclude completed todos
{ type: 'todo', completed: false },
{ type: { $in: ['habit', 'daily'] } },
],
}).exec();