spells: searing brightness should not affect challenge tasks (#8427)
* spells: searing brightness should not affect challenge tasks * fixed other incorrect group vs challenge task exclusions * fixed /tasks/clearCompletedTodos test didn't account for the new group task * fixed comment omission in tasks/clearCompletedTodos
This commit is contained in:
committed by
Matteo Pagliazzi
parent
86d65956d9
commit
8c8af83dfc
@@ -896,16 +896,24 @@ api.clearCompletedTodos = {
|
||||
let user = res.locals.user;
|
||||
|
||||
// Clear completed todos
|
||||
// Do not delete challenges completed todos unless the task is broken
|
||||
// Do not delete completed todos from challenges or groups, unless the task is broken
|
||||
await Tasks.Task.remove({
|
||||
userId: user._id,
|
||||
type: 'todo',
|
||||
completed: true,
|
||||
$or: [
|
||||
{'challenge.id': {$exists: false}},
|
||||
{'challenge.broken': {$exists: true}},
|
||||
{'group.id': {$exists: false}},
|
||||
{'group.broken': {$exists: true}},
|
||||
$and: [ // exclude challenge and group tasks
|
||||
{
|
||||
$or: [
|
||||
{'challenge.id': {$exists: false}},
|
||||
{'challenge.broken': {$exists: true}},
|
||||
],
|
||||
},
|
||||
{
|
||||
$or: [
|
||||
{'group.id': {$exists: false}},
|
||||
{'group.broken': {$exists: true}},
|
||||
],
|
||||
},
|
||||
],
|
||||
}).exec();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user