fix: hide unlinked old activities from current work
Imported follow-ups with no person, company, or deal stayed on the board because only linked prior records were archived. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -305,6 +305,13 @@ export class BillingService {
|
||||
SELECT 1 FROM "Deal" AS d2
|
||||
WHERE d2."id" = a."dealId" AND d2."importSource" = 'didar'
|
||||
)
|
||||
OR (
|
||||
a."personId" IS NULL
|
||||
AND a."companyId" IS NULL
|
||||
AND a."dealId" IS NULL
|
||||
AND a."dueAt" IS NOT NULL
|
||||
AND a."dueAt" < ${cutoff}
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -34,6 +34,7 @@ function stillOpenAhead(now: Date): Prisma.ActivityWhereInput {
|
||||
* فعالیت قبلی است اگر منبعش didar باشد،
|
||||
* یا قبل از روشن شدن ماژول ساخته شده و به شخص/شرکت/معاملهٔ قبلی وصل باشد.
|
||||
* معاملهٔ غیرقبلی مانع نمیشود؛ شخص قبلی (حتی اگر بعداً منبعش عوض شده) کافی است.
|
||||
* فعالیت بدون شخص و شرکت و معامله هم اگر موعدش قبل از همان لحظه باشد قبلی است.
|
||||
*/
|
||||
function historicalActivity(cutoff: Date): Prisma.ActivityWhereInput {
|
||||
return {
|
||||
@@ -52,6 +53,12 @@ function historicalActivity(cutoff: Date): Prisma.ActivityWhereInput {
|
||||
},
|
||||
{ company: { importSource: PRIOR_IMPORT_SOURCE } },
|
||||
{ deal: { importSource: PRIOR_IMPORT_SOURCE } },
|
||||
{
|
||||
personId: null,
|
||||
companyId: null,
|
||||
dealId: null,
|
||||
dueAt: { lt: cutoff },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user