fix(cron): process team board tasks assigned to the user

This commit is contained in:
Sabe Jones 2021-09-13 10:48:05 -05:00 committed by SabreCat
parent f843564444
commit 45fc2b62e3

View file

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