Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/api/my-review/myReview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The change from ON TRUE to ON r.id IS NOT NULL modifies the join condition, potentially altering the result set. Ensure that this change aligns with the intended logic and does not inadvertently exclude rows that should be included.

`,
Prisma.sql`
LEFT JOIN LATERAL (
Expand All @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Similar to the change on line 284, altering the join condition from ON TRUE to ON r.id IS NOT NULL could affect the result set. Verify that this change is intentional and does not exclude necessary rows.

`,
Prisma.sql`
LEFT JOIN LATERAL (
Expand All @@ -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"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Replacing the EXISTS subquery with TRUE changes the logic of determining hasAIReview. This could lead to incorrect data being returned if the presence of AI reviews is not properly checked. Ensure this change is intentional and correctly reflects the business logic.

FROM challenges."ChallengeReviewer" cr
WHERE cr."challengeId" = c.id
AND cr."aiWorkflowId" IS NOT NULL
LIMIT 1
) cr ON TRUE
`,
];
Expand Down