From f2997cf921b864296e7148d75a95a022ca65706d Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Sun, 2 Nov 2025 10:08:17 +1100 Subject: [PATCH] Additional performance tweaks --- src/api/my-review/myReview.service.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/api/my-review/myReview.service.ts b/src/api/my-review/myReview.service.ts index e2c59ed..5d3235c 100644 --- a/src/api/my-review/myReview.service.ts +++ b/src/api/my-review/myReview.service.ts @@ -281,7 +281,7 @@ export class MyReviewService { cp_incomplete.name ASC LIMIT 1 ) AS "incompletePhaseName" - ) deliverable_reviews ON TRUE + ) deliverable_reviews ON r.id IS NOT NULL `, Prisma.sql` LEFT JOIN LATERAL ( @@ -301,7 +301,7 @@ export class MyReviewService { WHERE rv_pending."resourceId" = r.id AND apr.id IS NULL ) AS "hasPendingAppealResponses" - ) pending_appeals ON TRUE + ) pending_appeals ON r.id IS NOT NULL `, Prisma.sql` LEFT JOIN LATERAL ( @@ -322,12 +322,11 @@ export class MyReviewService { Prisma.sql` LEFT JOIN LATERAL ( SELECT - EXISTS ( - SELECT 1 - FROM challenges."ChallengeReviewer" cr - WHERE cr."challengeId" = c.id - AND cr."aiWorkflowId" is not NULL - ) AS "hasAIReview" + TRUE AS "hasAIReview" + FROM challenges."ChallengeReviewer" cr + WHERE cr."challengeId" = c.id + AND cr."aiWorkflowId" IS NOT NULL + LIMIT 1 ) cr ON TRUE `, ];