donetick source: fix incorrectly including _assignable_ as well as assigned
This commit is contained in:
parent
74284f74f2
commit
bccb0cbb9e
2 changed files with 5 additions and 6 deletions
|
|
@ -44,11 +44,11 @@ describe('donetick source', () => {
|
||||||
user_id: 1,
|
user_id: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Should include: Water the plants (due today), Shared chore (overdue, in assignees)
|
// Should include: Water the plants (due today),
|
||||||
// Should exclude: Make the bed (done, nextDueDate=tomorrow), Walk the dog (different user), Inactive chore
|
// Should exclude: Make the bed (done, nextDueDate=tomorrow), Walk the dog (different user), Inactive chore, Shared chore
|
||||||
expect(chores).toHaveLength(2);
|
expect(chores).toHaveLength(1);
|
||||||
expect(chores.map((c) => c.text)).toContain('Water the plants');
|
expect(chores.map((c) => c.text)).toContain('Water the plants');
|
||||||
expect(chores.map((c) => c.text)).toContain('Shared chore');
|
expect(chores.map((c) => c.text)).not.toContain('Shared chore');
|
||||||
expect(chores.map((c) => c.text)).not.toContain('Make the bed');
|
expect(chores.map((c) => c.text)).not.toContain('Make the bed');
|
||||||
expect(chores.map((c) => c.text)).not.toContain('Walk the dog');
|
expect(chores.map((c) => c.text)).not.toContain('Walk the dog');
|
||||||
expect(chores.map((c) => c.text)).not.toContain('Inactive chore');
|
expect(chores.map((c) => c.text)).not.toContain('Inactive chore');
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ export async function fetchDonetickChores(
|
||||||
.filter(
|
.filter(
|
||||||
(c) =>
|
(c) =>
|
||||||
c.isActive &&
|
c.isActive &&
|
||||||
(c.assignedTo === config.user_id ||
|
c.assignedTo === config.user_id &&
|
||||||
c.assignees?.some((a) => a.userId === config.user_id)) &&
|
|
||||||
// Only include chores due today or overdue
|
// Only include chores due today or overdue
|
||||||
c.nextDueDate?.slice(0, 10) <= today
|
c.nextDueDate?.slice(0, 10) <= today
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue