fix: keep imported follow-ups out of current work

They stayed on the board when a non-prior deal was attached, even though the person was prior.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-15 12:34:40 +03:30
co-authored by Cursor
parent 6bc5e1bec7
commit 6bff9d2888
9 changed files with 102 additions and 16 deletions
+36
View File
@@ -36,6 +36,42 @@ describe('بایگانی اطلاعات قبل', () => {
});
});
it('فعالیت قدیمی روی شخص قبلی از کار جاری کنار می‌رود', () => {
const cutoff = new Date('2026-10-01T00:00:00.000Z');
const current = JSON.parse(JSON.stringify(activityPriorWhere('current', now, cutoff))) as {
OR: [
{
NOT: {
OR: [
{ importSource: string },
{
createdAt: { lt: string };
OR: Array<{ person?: { OR: Array<Record<string, string>> } }>;
},
];
};
},
{ status: string; dueAt: { gt: string } },
];
};
const linked = current.OR[0].NOT.OR[1];
assert.equal(linked.createdAt.lt, cutoff.toISOString());
assert.deepEqual(linked.OR[0], {
person: {
OR: [{ importSource: 'didar' }, { previousImportSource: 'didar' }],
},
});
assert.deepEqual(current.OR[1], { status: 'open', dueAt: { gt: now.toISOString() } });
const archive = JSON.parse(JSON.stringify(activityPriorWhere('archive', now, cutoff))) as {
AND: [unknown, { NOT: { status: string; dueAt: { gt: string } } }];
};
assert.deepEqual(archive.AND[0], current.OR[0].NOT);
assert.deepEqual(archive.AND[1], {
NOT: { status: 'open', dueAt: { gt: now.toISOString() } },
});
});
it('جستجوی کار جاری شخص قبلی را پیدا می‌کند', () => {
assert.equal(listPriorLens('current', 'علی', false), 'off');
assert.equal(listPriorLens('current', ' ', false), 'current');